pub struct OwnedFrozenValueTyped<T: StarlarkValue<'static>> { /* private fields */ }
Expand description

Same as OwnedFrozenValue but it is known to contain T.

Implementations§

source§

impl<T: StarlarkValue<'static>> OwnedFrozenValueTyped<T>

source

pub unsafe fn to_frozen_value(&self) -> FrozenValue

Erase the type.

This operation is unsafe because returned value is not bound by the heap lifetime. So if the heap is dropped, the returned value quetly becomes invalid.

source

pub fn to_value<'v>(&'v self) -> Value<'v>

Get a value reference.

source

pub fn to_owned_frozen_value(&self) -> OwnedFrozenValue

Erase the type.

source

pub fn into_owned_frozen_ref(self) -> OwnedFrozenRef<T>

Convert to an owned ref.

source

pub fn owner(&self) -> &FrozenHeapRef

Obtain a reference to the FrozenHeap that owns this value.

source

pub fn as_ref(&self) -> &T

Obtain a reference to the value.

source

pub unsafe fn owned_frozen_value(&self, heap: &FrozenHeap) -> FrozenValue

Extract a FrozenValue by passing the FrozenHeap which will keep it alive.

See OwnedFrozenValue::owned_frozen_value.

source

pub fn owned_value<'v>(&self, heap: &'v FrozenHeap) -> Value<'v>

Extract a Value by passing the FrozenHeap which will promise to keep it alive.

See OwnedFrozenValue::owned_value.

source

pub fn map<U: StarlarkValue<'static>>( &self, f: impl FnOnce(FrozenValueTyped<'_, T>) -> FrozenValueTyped<'_, U> ) -> OwnedFrozenValueTyped<U>

Operate on the FrozenValue stored inside. Safe provided you don’t store the argument FrozenValue after the closure has returned. Using this function is discouraged when possible.

source

pub fn try_map<U: StarlarkValue<'static>, E>( &self, f: impl FnOnce(FrozenValueTyped<'_, T>) -> Result<FrozenValueTyped<'_, U>, E> ) -> Result<OwnedFrozenValueTyped<U>, E>

Same as map above but with Result

Trait Implementations§

source§

impl<T: StarlarkValue<'static> + Allocative> Allocative for OwnedFrozenValueTyped<T>

source§

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

source§

impl<T: StarlarkValue<'static>> Clone for OwnedFrozenValueTyped<T>

source§

fn clone(&self) -> Self

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: Debug + StarlarkValue<'static>> Debug for OwnedFrozenValueTyped<T>

source§

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

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

impl<T: StarlarkValue<'static>> Deref for OwnedFrozenValueTyped<T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T: StarlarkValue<'static>> Dupe for OwnedFrozenValueTyped<T>

source§

fn dupe(&self) -> Self

Auto Trait Implementations§

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, 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.