pub unsafe trait InitStatus<T>: Copy {
type Value;
// Required methods
fn init(out: &mut Self::Value, t: T);
unsafe fn assume_init_ref(t: &Self::Value) -> &T;
unsafe fn assume_init_mut(t: &mut Self::Value) -> &mut T;
}
Expand description
This trait is used to write code that may work on matrices that may or may not be initialized.
This trait is used to describe how a value must be accessed to initialize it or
to retrieve a reference or mutable reference. Typically, a function accepting
both initialized and uninitialized inputs should have a Status: InitStatus<T>
type parameter. Then the methods of the Status
can be used to access the element.
§Safety
This trait must not be implemented outside of this crate.
Required Associated Types§
Required Methods§
Sourceunsafe fn assume_init_ref(t: &Self::Value) -> &T
unsafe fn assume_init_ref(t: &Self::Value) -> &T
Retrieve a reference to the element, assuming that it is initialized.
§Safety
This is unsound if the referenced value isn’t initialized.
Sourceunsafe fn assume_init_mut(t: &mut Self::Value) -> &mut T
unsafe fn assume_init_mut(t: &mut Self::Value) -> &mut T
Retrieve a mutable reference to the element, assuming that it is initialized.
§Safety
This is unsound if the referenced value isn’t initialized.
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.