Struct starlark::values::tuple::TupleRef

source ·
pub struct TupleRef<'v> { /* private fields */ }
Expand description

Reference to tuple data in Starlark heap.

Implementations§

source§

impl<'v> TupleRef<'v>

source

pub const TYPE: &'static str = FrozenTupleRef::TYPE

type(()), which is "tuple".

source

pub fn from_value(value: Value<'v>) -> Option<&'v TupleRef<'v>>

Downcast a value to a tuple.

source

pub fn from_frozen_value(value: FrozenValue) -> Option<&'v TupleRef<'v>>

Downcast a value to a tuple.

source

pub fn len(&self) -> usize

Number of elements.

source

pub fn content(&self) -> &[Value<'v>]

Tuple elements.

source

pub fn iter(&self) -> impl ExactSizeIterator<Item = Value<'v>> + '_

Iterate over the contents.

Trait Implementations§

source§

impl<'v> Debug for TupleRef<'v>

source§

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

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

impl<'v> StarlarkTypeRepr for &'v TupleRef<'v>

source§

fn starlark_type_repr() -> Ty

The representation of a type that a user would use verbatim in starlark type annotations
source§

impl<'v> UnpackValue<'v> for &'v TupleRef<'v>

source§

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 expected() -> String

Description of values acceptable by unpack_value, e. g. list or str.
source§

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>

Unpack value, but instead of None return error about incorrect argument type.
source§

fn unpack_named_param(value: Value<'v>, param_name: &str) -> Result<Self>

Unpack value, but instead of None return error about incorrect named argument type.
source§

impl<'v> Coerce<[Value<'v>]> for TupleRef<'v>

source§

impl<'v> Coerce<TupleRef<'v>> for [Value<'v>]

Auto Trait Implementations§

§

impl<'v> !RefUnwindSafe for TupleRef<'v>

§

impl<'v> Send for TupleRef<'v>

§

impl<'v> !Sized for TupleRef<'v>

§

impl<'v> !Sync for TupleRef<'v>

§

impl<'v> Unpin for TupleRef<'v>

§

impl<'v> UnwindSafe for TupleRef<'v>

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