[][src]Trait coercion::Coerce

pub unsafe trait Coerce<T: ?Sized> {
    unsafe fn coerce(self) -> T
    where
        Self: Sized,
        T: Sized
, { ... }
fn coerce_ptr(this: *const Self) -> *const T { ... }
fn coerce_mut_ptr(this: *mut Self) -> *mut T { ... } }

Unsafe, unchecked, coercion between types of the same size and alignment.

Provided methods

unsafe fn coerce(self) -> T where
    Self: Sized,
    T: Sized

Performs the coercion on an owned value.

Examples

use coercion::Coerce;

// Safe because 1 is non-zero.
let nonzero: NonZeroU64 = unsafe { 1u64.coerce() };
assert_eq!(nonzero.get(), 1);

fn coerce_ptr(this: *const Self) -> *const T

Perform the conversion on a const pointer.

fn coerce_mut_ptr(this: *mut Self) -> *mut T

Perform the conversion on a mut pointer.

Loading content...

Implementations on Foreign Types

impl<T, U> Coerce<[U]> for [T] where
    T: Coerce<U>, 
[src]

unsafe fn coerce(self) -> T where
    Self: Sized,
    T: Sized
[src]

fn coerce_mut_ptr(this: *mut Self) -> *mut T[src]

impl<T: ?Sized, U: ?Sized> Coerce<Box<U>> for Box<T> where
    T: Coerce<U>, 
[src]

fn coerce_mut_ptr(this: *mut Self) -> *mut T[src]

impl Coerce<str> for [u8][src]

unsafe fn coerce(self) -> T where
    Self: Sized,
    T: Sized
[src]

fn coerce_mut_ptr(this: *mut Self) -> *mut T[src]

impl Coerce<[u8]> for str[src]

unsafe fn coerce(self) -> T where
    Self: Sized,
    T: Sized
[src]

fn coerce_mut_ptr(this: *mut Self) -> *mut T[src]

impl<'a, T: ?Sized, U: ?Sized> Coerce<&'a T> for &'a U where
    T: Coerce<U>, 
[src]

unsafe fn coerce(self) -> T where
    Self: Sized,
    T: Sized
[src]

fn coerce_mut_ptr(this: *mut Self) -> *mut T[src]

impl<'a, T: ?Sized, U: ?Sized> Coerce<&'a mut T> for &'a mut U where
    T: Coerce<U>, 
[src]

unsafe fn coerce(self) -> T where
    Self: Sized,
    T: Sized
[src]

fn coerce_mut_ptr(this: *mut Self) -> *mut T[src]

impl<'a, T: ?Sized, U: ?Sized> Coerce<*const T> for *const U where
    T: Coerce<U>, 
[src]

unsafe fn coerce(self) -> T where
    Self: Sized,
    T: Sized
[src]

fn coerce_mut_ptr(this: *mut Self) -> *mut T[src]

impl<'a, T: ?Sized, U: ?Sized> Coerce<*mut T> for *mut U where
    T: Coerce<U>, 
[src]

unsafe fn coerce(self) -> T where
    Self: Sized,
    T: Sized
[src]

fn coerce_mut_ptr(this: *mut Self) -> *mut T[src]

impl<T: ?Sized, U: ?Sized> Coerce<ManuallyDrop<U>> for ManuallyDrop<T> where
    T: Coerce<U>, 
[src]

unsafe fn coerce(self) -> T where
    Self: Sized,
    T: Sized
[src]

fn coerce_ptr(this: *const Self) -> *const T[src]

fn coerce_mut_ptr(this: *mut Self) -> *mut T[src]

impl Coerce<i8> for u8[src]

impl Coerce<u8> for i8[src]

impl Coerce<NonZeroU8> for u8[src]

impl Coerce<u8> for NonZeroU8[src]

impl Coerce<NonZeroI8> for u8[src]

impl Coerce<u8> for NonZeroI8[src]

impl Coerce<AtomicU8> for u8[src]

impl Coerce<u8> for AtomicU8[src]

impl Coerce<AtomicI8> for u8[src]

impl Coerce<u8> for AtomicI8[src]

impl Coerce<bool> for u8[src]

impl Coerce<u8> for bool[src]

impl Coerce<AtomicBool> for u8[src]

impl Coerce<u8> for AtomicBool[src]

impl Coerce<NonZeroU8> for i8[src]

impl Coerce<i8> for NonZeroU8[src]

impl Coerce<NonZeroI8> for i8[src]

impl Coerce<i8> for NonZeroI8[src]

impl Coerce<AtomicU8> for i8[src]

impl Coerce<i8> for AtomicU8[src]

impl Coerce<AtomicI8> for i8[src]

impl Coerce<i8> for AtomicI8[src]

impl Coerce<bool> for i8[src]

impl Coerce<i8> for bool[src]

impl Coerce<AtomicBool> for i8[src]

impl Coerce<i8> for AtomicBool[src]

impl Coerce<NonZeroI8> for NonZeroU8[src]

impl Coerce<NonZeroU8> for NonZeroI8[src]

impl Coerce<AtomicU8> for NonZeroU8[src]

impl Coerce<NonZeroU8> for AtomicU8[src]

impl Coerce<AtomicI8> for NonZeroU8[src]

impl Coerce<NonZeroU8> for AtomicI8[src]

impl Coerce<bool> for NonZeroU8[src]

impl Coerce<NonZeroU8> for bool[src]

impl Coerce<AtomicBool> for NonZeroU8[src]

impl Coerce<NonZeroU8> for AtomicBool[src]

impl Coerce<AtomicU8> for NonZeroI8[src]

impl Coerce<NonZeroI8> for AtomicU8[src]

impl Coerce<AtomicI8> for NonZeroI8[src]

impl Coerce<NonZeroI8> for AtomicI8[src]

impl Coerce<bool> for NonZeroI8[src]

impl Coerce<NonZeroI8> for bool[src]

impl Coerce<AtomicBool> for NonZeroI8[src]

impl Coerce<NonZeroI8> for AtomicBool[src]

impl Coerce<AtomicI8> for AtomicU8[src]

impl Coerce<AtomicU8> for AtomicI8[src]

impl Coerce<bool> for AtomicU8[src]

impl Coerce<AtomicU8> for bool[src]

impl Coerce<AtomicBool> for AtomicU8[src]

impl Coerce<AtomicU8> for AtomicBool[src]

impl Coerce<bool> for AtomicI8[src]

impl Coerce<AtomicI8> for bool[src]

impl Coerce<AtomicBool> for AtomicI8[src]

impl Coerce<AtomicI8> for AtomicBool[src]

impl Coerce<AtomicBool> for bool[src]

impl Coerce<bool> for AtomicBool[src]

impl Coerce<i16> for u16[src]

impl Coerce<u16> for i16[src]

impl Coerce<NonZeroU16> for u16[src]

impl Coerce<u16> for NonZeroU16[src]

impl Coerce<NonZeroI16> for u16[src]

impl Coerce<u16> for NonZeroI16[src]

impl Coerce<AtomicU16> for u16[src]

impl Coerce<u16> for AtomicU16[src]

impl Coerce<AtomicI16> for u16[src]

impl Coerce<u16> for AtomicI16[src]

impl Coerce<NonZeroU16> for i16[src]

impl Coerce<i16> for NonZeroU16[src]

impl Coerce<NonZeroI16> for i16[src]

impl Coerce<i16> for NonZeroI16[src]

impl Coerce<AtomicU16> for i16[src]

impl Coerce<i16> for AtomicU16[src]

impl Coerce<AtomicI16> for i16[src]

impl Coerce<i16> for AtomicI16[src]

impl Coerce<NonZeroI16> for NonZeroU16[src]

impl Coerce<NonZeroU16> for NonZeroI16[src]

impl Coerce<AtomicU16> for NonZeroU16[src]

impl Coerce<NonZeroU16> for AtomicU16[src]

impl Coerce<AtomicI16> for NonZeroU16[src]

impl Coerce<NonZeroU16> for AtomicI16[src]

impl Coerce<AtomicU16> for NonZeroI16[src]

impl Coerce<NonZeroI16> for AtomicU16[src]

impl Coerce<AtomicI16> for NonZeroI16[src]

impl Coerce<NonZeroI16> for AtomicI16[src]

impl Coerce<AtomicI16> for AtomicU16[src]

impl Coerce<AtomicU16> for AtomicI16[src]

impl Coerce<i32> for u32[src]

impl Coerce<u32> for i32[src]

impl Coerce<NonZeroU32> for u32[src]

impl Coerce<u32> for NonZeroU32[src]

impl Coerce<NonZeroI32> for u32[src]

impl Coerce<u32> for NonZeroI32[src]

impl Coerce<AtomicU32> for u32[src]

impl Coerce<u32> for AtomicU32[src]

impl Coerce<AtomicI32> for u32[src]

impl Coerce<u32> for AtomicI32[src]

impl Coerce<NonZeroU32> for i32[src]

impl Coerce<i32> for NonZeroU32[src]

impl Coerce<NonZeroI32> for i32[src]

impl Coerce<i32> for NonZeroI32[src]

impl Coerce<AtomicU32> for i32[src]

impl Coerce<i32> for AtomicU32[src]

impl Coerce<AtomicI32> for i32[src]

impl Coerce<i32> for AtomicI32[src]

impl Coerce<NonZeroI32> for NonZeroU32[src]

impl Coerce<NonZeroU32> for NonZeroI32[src]

impl Coerce<AtomicU32> for NonZeroU32[src]

impl Coerce<NonZeroU32> for AtomicU32[src]

impl Coerce<AtomicI32> for NonZeroU32[src]

impl Coerce<NonZeroU32> for AtomicI32[src]

impl Coerce<AtomicU32> for NonZeroI32[src]

impl Coerce<NonZeroI32> for AtomicU32[src]

impl Coerce<AtomicI32> for NonZeroI32[src]

impl Coerce<NonZeroI32> for AtomicI32[src]

impl Coerce<AtomicI32> for AtomicU32[src]

impl Coerce<AtomicU32> for AtomicI32[src]

impl Coerce<i64> for u64[src]

impl Coerce<u64> for i64[src]

impl Coerce<NonZeroU64> for u64[src]

impl Coerce<u64> for NonZeroU64[src]

impl Coerce<NonZeroI64> for u64[src]

impl Coerce<u64> for NonZeroI64[src]

impl Coerce<AtomicU64> for u64[src]

impl Coerce<u64> for AtomicU64[src]

impl Coerce<AtomicI64> for u64[src]

impl Coerce<u64> for AtomicI64[src]

impl Coerce<NonZeroU64> for i64[src]

impl Coerce<i64> for NonZeroU64[src]

impl Coerce<NonZeroI64> for i64[src]

impl Coerce<i64> for NonZeroI64[src]

impl Coerce<AtomicU64> for i64[src]

impl Coerce<i64> for AtomicU64[src]

impl Coerce<AtomicI64> for i64[src]

impl Coerce<i64> for AtomicI64[src]

impl Coerce<NonZeroI64> for NonZeroU64[src]

impl Coerce<NonZeroU64> for NonZeroI64[src]

impl Coerce<AtomicU64> for NonZeroU64[src]

impl Coerce<NonZeroU64> for AtomicU64[src]

impl Coerce<AtomicI64> for NonZeroU64[src]

impl Coerce<NonZeroU64> for AtomicI64[src]

impl Coerce<AtomicU64> for NonZeroI64[src]

impl Coerce<NonZeroI64> for AtomicU64[src]

impl Coerce<AtomicI64> for NonZeroI64[src]

impl Coerce<NonZeroI64> for AtomicI64[src]

impl Coerce<AtomicI64> for AtomicU64[src]

impl Coerce<AtomicU64> for AtomicI64[src]

impl Coerce<i128> for u128[src]

impl Coerce<u128> for i128[src]

impl Coerce<NonZeroU128> for u128[src]

impl Coerce<u128> for NonZeroU128[src]

impl Coerce<NonZeroI128> for u128[src]

impl Coerce<u128> for NonZeroI128[src]

impl Coerce<NonZeroU128> for i128[src]

impl Coerce<i128> for NonZeroU128[src]

impl Coerce<NonZeroI128> for i128[src]

impl Coerce<i128> for NonZeroI128[src]

impl Coerce<NonZeroI128> for NonZeroU128[src]

impl Coerce<NonZeroU128> for NonZeroI128[src]

impl Coerce<isize> for usize[src]

impl Coerce<usize> for isize[src]

impl Coerce<NonZeroUsize> for usize[src]

impl Coerce<usize> for NonZeroUsize[src]

impl Coerce<NonZeroIsize> for usize[src]

impl Coerce<usize> for NonZeroIsize[src]

impl Coerce<AtomicUsize> for usize[src]

impl Coerce<usize> for AtomicUsize[src]

impl Coerce<AtomicIsize> for usize[src]

impl Coerce<usize> for AtomicIsize[src]

impl Coerce<NonZeroUsize> for isize[src]

impl Coerce<isize> for NonZeroUsize[src]

impl Coerce<NonZeroIsize> for isize[src]

impl Coerce<isize> for NonZeroIsize[src]

impl Coerce<AtomicUsize> for isize[src]

impl Coerce<isize> for AtomicUsize[src]

impl Coerce<AtomicIsize> for isize[src]

impl Coerce<isize> for AtomicIsize[src]

impl Coerce<NonZeroIsize> for NonZeroUsize[src]

impl Coerce<NonZeroUsize> for NonZeroIsize[src]

impl Coerce<AtomicUsize> for NonZeroUsize[src]

impl Coerce<NonZeroUsize> for AtomicUsize[src]

impl Coerce<AtomicIsize> for NonZeroUsize[src]

impl Coerce<NonZeroUsize> for AtomicIsize[src]

impl Coerce<AtomicUsize> for NonZeroIsize[src]

impl Coerce<NonZeroIsize> for AtomicUsize[src]

impl Coerce<AtomicIsize> for NonZeroIsize[src]

impl Coerce<NonZeroIsize> for AtomicIsize[src]

impl Coerce<AtomicIsize> for AtomicUsize[src]

impl Coerce<AtomicUsize> for AtomicIsize[src]

Loading content...

Implementors

Loading content...