pub trait AccessAs {
// Required methods
fn ref_as<T>(&self) -> Self::Guard<'_>
where Self: IGuardRef<T>,
T: ?Sized;
fn mut_as<T>(&mut self) -> Self::GuardMut<'_>
where Self: IGuardMut<T>,
T: ?Sized;
}Expand description
Provides access to a value as if it were of another type.
This is done by the following process:
- memcopy
selfintocopy - convert
copyintotarget: ManuallyDrop<Target> - provide a guard that can
DereforDerefMutintotarget - upon dropping the mutable guard, convert
targetand assingtargettoself
This is always safe for non-self-referencial types.
Required Methods§
Object Safety§
This trait is not object safe.