Struct starlark::values::OwnedFrozenRef
source · pub struct OwnedFrozenRef<T: ?Sized + 'static> { /* private fields */ }
Expand description
Same as a FrozenRef
, but it keeps itself alive by storing a reference to the owning heap.
Usually constructed from an OwnedFrozenValueTyped
.
Implementations§
source§impl<T: ?Sized> OwnedFrozenRef<T>
impl<T: ?Sized> OwnedFrozenRef<T>
sourcepub unsafe fn new_unchecked(
value: &'static T,
owner: FrozenHeapRef
) -> OwnedFrozenRef<T>
pub unsafe fn new_unchecked( value: &'static T, owner: FrozenHeapRef ) -> OwnedFrozenRef<T>
Creates a new OwnedFrozenRef
pointing at the given value.
§Safety
The reference must be kept alive by the owning heap
sourcepub fn map<F, U: ?Sized>(self, f: F) -> OwnedFrozenRef<U>
pub fn map<F, U: ?Sized>(self, f: F) -> OwnedFrozenRef<U>
Converts self
into a new reference that points at something reachable from the previous.
See the caveats on [starlark::values::OwnedFrozenValue::map]
sourcepub fn try_map_result<F, U: ?Sized, E>(
self,
f: F
) -> Result<OwnedFrozenRef<U>, E>
pub fn try_map_result<F, U: ?Sized, E>( self, f: F ) -> Result<OwnedFrozenRef<U>, E>
Fallible map the reference to another one.
sourcepub fn try_map_option<F, U: ?Sized>(self, f: F) -> Option<OwnedFrozenRef<U>>
pub fn try_map_option<F, U: ?Sized>(self, f: F) -> Option<OwnedFrozenRef<U>>
Optionally map the reference to another one.
sourcepub fn owner(&self) -> &FrozenHeapRef
pub fn owner(&self) -> &FrozenHeapRef
Get a reference to the owning frozen heap
Trait Implementations§
source§impl<T: ?Sized + 'static + Allocative> Allocative for OwnedFrozenRef<T>
impl<T: ?Sized + 'static + Allocative> Allocative for OwnedFrozenRef<T>
source§impl<T: Clone + ?Sized + 'static> Clone for OwnedFrozenRef<T>
impl<T: Clone + ?Sized + 'static> Clone for OwnedFrozenRef<T>
source§fn clone(&self) -> OwnedFrozenRef<T>
fn clone(&self) -> OwnedFrozenRef<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: ?Sized> Deref for OwnedFrozenRef<T>
impl<T: ?Sized> Deref for OwnedFrozenRef<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for OwnedFrozenRef<T>
impl<T: ?Sized> Send for OwnedFrozenRef<T>where
T: Sync,
impl<T: ?Sized> Sync for OwnedFrozenRef<T>where
T: Sync,
impl<T: ?Sized> Unpin for OwnedFrozenRef<T>
impl<T> !UnwindSafe for OwnedFrozenRef<T>
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