Foreign Type fat_type::Erased

source · []
extern {
    pub type Erased;
}
Expand description

A value with an erased type. Values of this type cannot be created or accessed and support no operations.

As such, this type implements all of the standard auto traits. As a convenience it also implements the Debug trait, which simply prints "Erased".

Example

let fat1 = Fat::<dyn Debug, u32>::new(42);
let thin1: &mut Fat<dyn Debug, Erased> = Fat::erase_mut(&mut fat1);

let fat2 = Fat::<dyn Debug, u64>::new(43);
let thin2: &mut Fat<dyn Debug, Erased> = Fat::erase_mut(&mut fat2);

// Even though thin1 and thin2 have the same type, we can't swap them
// because Erased is an extern type.
mem::swap(thin1, thin2); //E0227

Trait Implementations

Prints "Erased". The value is not accessed in any way.