Skip to main content

AsUnsafe

Trait AsUnsafe 

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

Helper trait to compute the unsafe version of a function pointer type while preserving arity, abi and signature.

§Example

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

Required Associated Types§

Source

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

The unsafe version of a 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<Unsafe>> AsUnsafe<F> for F

Source§

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