pub unsafe trait TrbCast: FromBytes + AsBytes + 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>
Object Safety§
This trait is not object safe.