WithArgs

Trait WithArgs 

Source
pub trait WithArgs<Args: Tuple>: FnPtr {
    type F: FnPtr<Args = Args, Output = Self::Output, Safety = Self::Safety, Abi = Self::Abi>;
}
Expand description

Helper trait to change the argument types of a function pointer type while preserving its safety, abi and return type.

This is used by with_args! under the hood.

§Example

type F = extern "C" fn(i32) -> i32;
type G = <F as WithArgs<(u8, u16)>>::F;
// `G` `extern "C" fn(u8, u16) -> i32`

Required Associated Types§

Source

type F: FnPtr<Args = Args, Output = Self::Output, Safety = Self::Safety, Abi = Self::Abi>

The function pointer type with the requested argument type(s) (preserving all other properties).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Args: Tuple, F: FnPtr + WithArgsImpl<Self>> WithArgs<Args> for F

Source§

type F = <F as WithArgsImpl>::F<Args>