(* Generated by coq-of-rust *)
Require Import CoqOfRust.CoqOfRust.

Module future.
  (* StructTuple
    {
      name := "ResumeTy";
      const_params := [];
      ty_params := [];
      fields :=
        [
          Ty.apply
            (Ty.path "core::ptr::non_null::NonNull")
            []
            [ Ty.path "core::task::wake::Context" ]
        ];
    } *)
  
  Module Impl_core_fmt_Debug_for_core_future_ResumeTy.
    Definition Self : Ty.t := Ty.path "core::future::ResumeTy".
    
    (* Debug *)
    Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; f ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let f := M.alloc (| f |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.path "core::fmt::Formatter",
              "debug_tuple_field1_finish",
              []
            |),
            [
              M.read (| f |);
              M.read (| Value.String "ResumeTy" |);
              M.alloc (|
                M.SubPointer.get_struct_tuple_field (|
                  M.read (| self |),
                  "core::future::ResumeTy",
                  0
                |)
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Debug"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Debug_for_core_future_ResumeTy.
  
  Module Impl_core_marker_Copy_for_core_future_ResumeTy.
    Definition Self : Ty.t := Ty.path "core::future::ResumeTy".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::Copy"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_Copy_for_core_future_ResumeTy.
  
  Module Impl_core_clone_Clone_for_core_future_ResumeTy.
    Definition Self : Ty.t := Ty.path "core::future::ResumeTy".
    
    (* Clone *)
    Definition clone (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            M.match_operator (|
              Value.DeclaredButUndefined,
              [ fun γ => ltac:(M.monadic (M.read (| self |))) ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::clone::Clone"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("clone", InstanceField.Method clone) ].
  End Impl_core_clone_Clone_for_core_future_ResumeTy.
  
  Module Impl_core_marker_Send_for_core_future_ResumeTy.
    Definition Self : Ty.t := Ty.path "core::future::ResumeTy".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::Send"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_Send_for_core_future_ResumeTy.
  
  Module Impl_core_marker_Sync_for_core_future_ResumeTy.
    Definition Self : Ty.t := Ty.path "core::future::ResumeTy".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::Sync"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_Sync_for_core_future_ResumeTy.
  
  (*
  pub unsafe fn get_context<'a, 'b>(cx: ResumeTy) -> &'a mut Context<'b> {
      // SAFETY: the caller must guarantee that `cx.0` is a valid pointer
      // that fulfills all the requirements for a mutable reference.
      unsafe { &mut *cx.0.as_ptr().cast() }
  }
  *)
  Definition get_context (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ cx ] =>
      ltac:(M.monadic
        (let cx := M.alloc (| cx |) in
        M.call_closure (|
          M.get_associated_function (|
            Ty.apply (Ty.path "*mut") [] [ Ty.path "core::task::wake::Context" ],
            "cast",
            [ Ty.path "core::task::wake::Context" ]
          |),
          [
            M.call_closure (|
              M.get_associated_function (|
                Ty.apply
                  (Ty.path "core::ptr::non_null::NonNull")
                  []
                  [ Ty.path "core::task::wake::Context" ],
                "as_ptr",
                []
              |),
              [
                M.read (|
                  M.SubPointer.get_struct_tuple_field (| cx, "core::future::ResumeTy", 0 |)
                |)
              ]
            |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_get_context : M.IsFunction "core::future::get_context" get_context.
End future.
