Skip to main content

AsSafe

Trait AsSafe 

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

Helper trait to compute the safe version of a function pointer type while preserving its abi, arguments and return type. Equivalent to WithSafety<Safe>.

§Example

type U = unsafe extern "C" fn(i32) -> i32;
type S = <U as AsSafe>::F;
// `S` is `extern "C" fn(i32) -> i32`

Required Associated Types§

Source

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

The safe version of this function pointer type.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<F: FnPtr + WithSafety<Safe>> AsSafe for F

Source§

type F = <F as WithSafety<Safe>>::F