WithOutput

Trait WithOutput 

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

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

This is used by with_output! under the hood.

§Example

type F = extern "C" fn(i32) -> i32;
type G = <F as WithOutput<u32>>::F;
// `G` is `extern "C" fn(i32) -> u32`

Required Associated Types§

Source

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

The function pointer type with the requested return type (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<Output, F: FnPtr + WithOutputImpl<Self>> WithOutput<Output> for F

Source§

type F = <F as WithOutputImpl>::F<Output>