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>

source

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

source

pub fn as_ref<'a>(&'a self) -> &'a T

Returns a reference to the underlying value.

source

pub fn map<F, U: ?Sized>(self, f: F) -> OwnedFrozenRef<U>
where for<'v> F: FnOnce(&'v T) -> &'v U,

Converts self into a new reference that points at something reachable from the previous.

See the caveats on [starlark::values::OwnedFrozenValue::map]

source

pub fn try_map_result<F, U: ?Sized, E>( self, f: F ) -> Result<OwnedFrozenRef<U>, E>
where for<'v> F: FnOnce(&'v T) -> Result<&'v U, E>,

Fallible map the reference to another one.

source

pub fn try_map_option<F, U: ?Sized>(self, f: F) -> Option<OwnedFrozenRef<U>>
where for<'v> F: FnOnce(&'v T) -> Option<&'v U>,

Optionally map the reference to another one.

source

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>

source§

fn visit<'allocative_a, 'allocative_b: 'allocative_a>( &self, visitor: &'allocative_a mut Visitor<'allocative_b> )

source§

impl<T: Clone + ?Sized + 'static> Clone for OwnedFrozenRef<T>

source§

fn clone(&self) -> OwnedFrozenRef<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: ?Sized + Debug> Debug for OwnedFrozenRef<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: ?Sized> Deref for OwnedFrozenRef<T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &T

Dereferences the value.
source§

impl<T: ?Sized + Display> Display for OwnedFrozenRef<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: ?Sized + 'static + Dupe> Dupe for OwnedFrozenRef<T>

source§

fn dupe(&self) -> Self

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToAst for T

source§

fn ast(self, begin: usize, end: usize) -> Spanned<Self>

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.