Trait mica_hl::MutSelfFromRawValue
source · [−]pub trait MutSelfFromRawValuewhere
Self: Sized,{
type Guard;
unsafe fn mut_self_from_raw_value(
value: &RawValue
) -> Result<(&mut Self, Self::Guard), Error>;
}
Expand description
Implemented by all types that can be a &mut self
parameter in an instance function.
Required Associated Types
Required Methods
Returns a mutable reference to Self
without checking that the value is of the correct
type.
This trait is only available for value types with interior mutability, as this function receives a shared, rather than mutable, reference.
Safety
This assumes the value is of the correct type. Calling this with a value whose type is not
Self
results in undefined behavior.
Because GATs aren’t stable yet, Self::Guard
can keep a raw pointer to the value
and as such must not outlive the value.