macro_rules! with_safety {
( safe, $ty:ty ) => { ... };
( unsafe, $ty:ty ) => { ... };
( $safety:path, $ty:ty ) => { ... };
( $safety:tt, $ty:ty ) => { ... };
( @inner $safety:ty, $ty:ty ) => { ... };
}Expand description
Construct a function-pointer type identical to the given one but using the specified safety.
Accepts either:
ยงExamples
type F = with_safety!(safety::Safe, unsafe extern "C" fn(i32) -> i32);
// `F` is `extern "C" fn(i32) -> i32`
type G = with_safety!(unsafe, fn());
// `G` is `unsafe fn()`