pub struct Ref<'a, T: ?Sized> { /* private fields */ }Expand description
Shared (immutable) borrow guard for account data.
On drop, decrements the borrow count in RuntimeAccount.borrow_state.
Implementations§
Source§impl<'a, T: ?Sized> Ref<'a, T>
impl<'a, T: ?Sized> Ref<'a, T>
Sourcepub unsafe fn from_raw_parts(value: &'a T, state: *mut u8) -> Self
pub unsafe fn from_raw_parts(value: &'a T, state: *mut u8) -> Self
Create a shared borrow guard from raw parts.
§Safety
The caller must ensure:
- The borrow state at
statewas already incremented valueis valid for lifetime'astatepoints to a validRuntimeAccount.borrow_state
Sourcepub fn into_raw_parts(self) -> (&'a T, *mut u8)
pub fn into_raw_parts(self) -> (&'a T, *mut u8)
Decompose into raw parts without running the destructor.
The caller takes responsibility for eventually releasing the
borrow (decrementing *state).
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for Ref<'a, T>where
T: ?Sized,
impl<'a, T> RefUnwindSafe for Ref<'a, T>where
T: RefUnwindSafe + ?Sized,
impl<'a, T> !Send for Ref<'a, T>
impl<'a, T> !Sync for Ref<'a, T>
impl<'a, T> Unpin for Ref<'a, T>where
T: ?Sized,
impl<'a, T> UnsafeUnpin for Ref<'a, T>where
T: ?Sized,
impl<'a, T> UnwindSafe for Ref<'a, T>where
T: RefUnwindSafe + ?Sized,
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