Skip to main content

WithAbi

Trait WithAbi 

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

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

This is used by with_abi! under the hood.

§Example

type F = extern "C" fn(i32) -> i32;
type G = <F as WithAbi<abi::System>>::F;
// `G` is `extern "system" fn(i32) -> i32`

Required Associated Types§

Source

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

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Abi: Abi, F: FnPtr + WithAbiImpl<Abi, Self>> WithAbi<Abi> for F

Source§

type F = <F as WithAbiImpl<Abi>>::F