pub unsafe trait TrbCast:
FromBytes
+ Immutable
+ IntoBytes
+ KnownLayout
+ TypedTrb {
// Provided methods
fn cast<T: TrbCast>(&self) -> Result<&T, Error> { ... }
fn cast_mut<T: TrbCast>(&mut self) -> Result<&mut T, Error> { ... }
fn checked_cast<T: TrbCast>(&self) -> Result<&T, Error> { ... }
fn checked_mut_cast<T: TrbCast>(&mut self) -> Result<&mut T, Error> { ... }
}Expand description
§Safety
All trb structs have the same size. One trb could be safely casted to another, though the values might be invalid.
Provided Methods§
fn cast<T: TrbCast>(&self) -> Result<&T, Error>
fn cast_mut<T: TrbCast>(&mut self) -> Result<&mut T, Error>
fn checked_cast<T: TrbCast>(&self) -> Result<&T, Error>
fn checked_mut_cast<T: TrbCast>(&mut self) -> Result<&mut T, Error>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.