pub struct OxRef<'a> {
pub shape: &'static Shape,
/* private fields */
}Expand description
Safe read-only reference with shape.
Unlike OxPtrConst, this has a lifetime parameter for borrow checking.
Fields§
§shape: &'static ShapeThe shape describing the type.
Implementations§
Source§impl<'a> OxRef<'a>
impl<'a> OxRef<'a>
Sourcepub const fn new(ptr: PtrConst, shape: &'static Shape) -> Self
pub const fn new(ptr: PtrConst, shape: &'static Shape) -> Self
Create a new OxRef from a pointer and shape.
Sourcepub unsafe fn get_as<T: 'static>(
&self,
expected_shape: &'static Shape,
) -> Option<&'a T>
pub unsafe fn get_as<T: 'static>( &self, expected_shape: &'static Shape, ) -> Option<&'a T>
Get a typed reference if the shape matches.
§Safety
The caller must ensure that T is the correct type for expected_shape.
Sourcepub const fn as_ptr_const(&self) -> OxPtrConst
pub const fn as_ptr_const(&self) -> OxPtrConst
Convert to an unlifetimed OxPtrConst.
Trait Implementations§
Source§impl<'a> From<OxRef<'a>> for OxPtrConst
impl<'a> From<OxRef<'a>> for OxPtrConst
Source§impl PartialOrd for OxRef<'_>
impl PartialOrd for OxRef<'_>
impl<'a> Copy for OxRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for OxRef<'a>
impl<'a> RefUnwindSafe for OxRef<'a>
impl<'a> !Send for OxRef<'a>
impl<'a> !Sync for OxRef<'a>
impl<'a> Unpin for OxRef<'a>
impl<'a> UnwindSafe for OxRef<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more