Struct starlark::values::ValueTyped
source · pub struct ValueTyped<'v, T: StarlarkValue<'v>>(/* private fields */);
Expand description
Value
wrapper which asserts contained value is of type <T>
.
Implementations§
source§impl<'v> ValueTyped<'v, StarlarkStr>
impl<'v> ValueTyped<'v, StarlarkStr>
sourcepub fn freeze(self, freezer: &Freezer) -> Result<FrozenStringValue>
pub fn freeze(self, freezer: &Freezer) -> Result<FrozenStringValue>
Convert a value to a FrozenStringValue
using a supplied Freezer
.
sourcepub fn get_hashed(self) -> Hashed<Self>
pub fn get_hashed(self) -> Hashed<Self>
Get self along with the hash.
sourcepub fn get_hashed_str(self) -> Hashed<&'v str>
pub fn get_hashed_str(self) -> Hashed<&'v str>
Get the string reference along with the hash.
sourcepub fn get_hashed_value(self) -> Hashed<Value<'v>>
pub fn get_hashed_value(self) -> Hashed<Value<'v>>
Get the Value
along with the hash.
sourcepub fn unpack_frozen(self) -> Option<FrozenStringValue>
pub fn unpack_frozen(self) -> Option<FrozenStringValue>
If this string value is frozen, return it.
source§impl<'v, T: StarlarkValue<'v>> ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> ValueTyped<'v, T>
sourcepub fn new(value: Value<'v>) -> Option<ValueTyped<'v, T>>
pub fn new(value: Value<'v>) -> Option<ValueTyped<'v, T>>
Downcast.
sourcepub fn new_err(value: Value<'v>) -> Result<ValueTyped<'v, T>>
pub fn new_err(value: Value<'v>) -> Result<ValueTyped<'v, T>>
Downcast.
sourcepub unsafe fn new_unchecked(value: Value<'v>) -> ValueTyped<'v, T>
pub unsafe fn new_unchecked(value: Value<'v>) -> ValueTyped<'v, T>
Construct typed value without checking the value is of type <T>
.
source§impl<'v> ValueTyped<'v, StarlarkStr>
impl<'v> ValueTyped<'v, StarlarkStr>
Trait Implementations§
source§impl<'v, T: StarlarkValue<'v>> AllocValue<'v> for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> AllocValue<'v> for ValueTyped<'v, T>
source§impl<'v, T: StarlarkValue<'v>> Allocative for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> Allocative for ValueTyped<'v, T>
source§impl<'v, T: StarlarkValue<'v>> Clone for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> Clone for ValueTyped<'v, T>
source§impl<'v, T: StarlarkValue<'v>> Debug for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> Debug for ValueTyped<'v, T>
source§impl<'v, T: StarlarkValue<'v>> Deref for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> Deref for ValueTyped<'v, T>
source§impl<'v, T: StarlarkValue<'v>> Display for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> Display for ValueTyped<'v, T>
source§impl<'v, T: StarlarkValue<'v>> Dupe for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> Dupe for ValueTyped<'v, T>
source§impl<'v> Equivalent<ValueTyped<'v, StarlarkStr>> for FrozenStringValue
impl<'v> Equivalent<ValueTyped<'v, StarlarkStr>> for FrozenStringValue
source§fn equivalent(&self, key: &StringValue<'v>) -> bool
fn equivalent(&self, key: &StringValue<'v>) -> bool
Compare self to
key
and return true
if they are equal.source§impl<'v, T> From<ValueTyped<'v, T>> for ValueTypedComplex<'v, T>
impl<'v, T> From<ValueTyped<'v, T>> for ValueTypedComplex<'v, T>
source§fn from(t: ValueTyped<'v, T>) -> Self
fn from(t: ValueTyped<'v, T>) -> Self
Converts to this type from the input type.
source§impl<'v> PartialEq<ValueTyped<'v, StarlarkStr>> for FrozenStringValue
impl<'v> PartialEq<ValueTyped<'v, StarlarkStr>> for FrozenStringValue
source§fn eq(&self, other: &StringValue<'v>) -> bool
fn eq(&self, other: &StringValue<'v>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'v, T: StarlarkValue<'v>> PartialEq for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> PartialEq for ValueTyped<'v, T>
source§impl<'v, T: StarlarkValue<'v> + ProvidesStaticType<'v> + Sized> ProvidesStaticType<'v> for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v> + ProvidesStaticType<'v> + Sized> ProvidesStaticType<'v> for ValueTyped<'v, T>
§type StaticType = ValueTyped<'static, <T as ProvidesStaticType<'v>>::StaticType>
type StaticType = ValueTyped<'static, <T as ProvidesStaticType<'v>>::StaticType>
source§impl<'v, T: StarlarkValue<'v>> Serialize for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> Serialize for ValueTyped<'v, T>
source§impl<'v, T: StarlarkValue<'v>> StarlarkTypeRepr for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> StarlarkTypeRepr for ValueTyped<'v, T>
source§fn starlark_type_repr() -> Ty
fn starlark_type_repr() -> Ty
The representation of a type that a user would use verbatim in starlark type annotations
source§impl<'v, T: StarlarkValue<'v>> Trace<'v> for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> Trace<'v> for ValueTyped<'v, T>
source§impl<'v, T: StarlarkValue<'v>> UnpackValue<'v> for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> UnpackValue<'v> for ValueTyped<'v, T>
source§fn unpack_value(value: Value<'v>) -> Option<Self>
fn unpack_value(value: Value<'v>) -> Option<Self>
Given a
Value
, try and unpack it into the given type, which may involve some element of conversion.source§fn unpack_value_err(value: Value<'v>) -> Result<Self>
fn unpack_value_err(value: Value<'v>) -> Result<Self>
Unpack a value, but return error instead of
None
if unpacking fails.source§fn unpack_param(value: Value<'v>) -> Result<Self>
fn unpack_param(value: Value<'v>) -> Result<Self>
Unpack value, but instead of
None
return error about incorrect argument type.impl<'v, T: StarlarkValue<'v>> Coerce<Value<'v>> for ValueTyped<'v, T>
impl<'v> Coerce<ValueTyped<'v, StarlarkStr>> for FrozenStringValue
impl<'v, T: StarlarkValue<'v>> Coerce<ValueTyped<'v, T>> for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> CoerceKey<Value<'v>> for ValueTyped<'v, T>
impl<'v> CoerceKey<ValueTyped<'v, StarlarkStr>> for FrozenStringValue
impl<'v, T: StarlarkValue<'v>> CoerceKey<ValueTyped<'v, T>> for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> Copy for ValueTyped<'v, T>
impl<'v, T: StarlarkValue<'v>> Eq for ValueTyped<'v, T>
Auto Trait Implementations§
impl<'v, T> !RefUnwindSafe for ValueTyped<'v, T>
impl<'v, T> Send for ValueTyped<'v, T>where
T: Sync,
impl<'v, T> !Sync for ValueTyped<'v, T>
impl<'v, T> Unpin for ValueTyped<'v, T>
impl<'v, T> UnwindSafe for ValueTyped<'v, T>where
T: RefUnwindSafe,
Blanket Implementations§
source§impl<'a, T> AnyLifetime<'a> for Twhere
T: ProvidesStaticType<'a> + 'a + ?Sized,
impl<'a, T> AnyLifetime<'a> for Twhere
T: ProvidesStaticType<'a> + 'a + ?Sized,
source§fn static_type_id() -> TypeId
fn static_type_id() -> TypeId
Must return the
TypeId
of Self
but where the lifetimes are changed
to 'static
. Must be consistent with static_type_of
.source§fn static_type_of(&self) -> TypeId
fn static_type_of(&self) -> TypeId
Must return the
TypeId
of Self
but where the lifetimes are changed
to 'static
. Must be consistent with static_type_id
. Must not
consult the self
parameter in any way.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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.