/// A borrowed type with the same memory layout as the type itself that can be used to construct ABI-compatible function signatures. #[repr(transparent)] pubstructRef<'a, T: Type<T>>(T::Abi, core::marker::PhantomData<&'a T>);
impl<T: Type<T>> Ref<'_, T> { /// Returns `true` if the argument is null. pubfn is_null(&self) -> bool {
T::is_null(&self.0)
}
/// Converts the argument to a [`Result<&T>`] reference. pubfn ok(&self) -> Result<&T> { self.as_ref()
.ok_or_else(|| Error::from_hresult(imp::E_POINTER))
}
/// Converts the argument to a [`Option<&T>`] reference. pubfn as_ref(&self) -> Option<&T> { ifself.is_null() {
None
} else { unsafe { Some(self.assume_init_ref()) }
}
}
/// Converts the argument to a `&T` reference. /// /// # Panics /// /// Panics if the argument is null. #[track_caller] pubfn unwrap(&self) -> &T { self.as_ref().expect("called `Ref::unwrap` on a null value")
}
/// Converts the argument to an [`Option<T>`] by cloning the reference. pubfn cloned(&self) -> Option<T> { self.as_ref().cloned()
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.