pub struct StructOf<'v, V: UnpackValue<'v>> { /* private fields */ }
Expand description

Like ValueOf, but only validates value types; does not construct or store a map.

Implementations§

source§

impl<'v, V: UnpackValue<'v>> StructOf<'v, V>

source

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

Get the actual value this StructOf wraps.

source

pub fn to_map(&self) -> SmallMap<StringValue<'v>, V>

Collect field structs.

Trait Implementations§

source§

impl<'v, V: Debug + UnpackValue<'v>> Debug for StructOf<'v, V>

source§

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

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

impl<'v, V: UnpackValue<'v>> StarlarkTypeRepr for StructOf<'v, 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, V: UnpackValue<'v>> UnpackValue<'v> for StructOf<'v, V>

source§

fn expected() -> String

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

fn unpack_value(value: Value<'v>) -> Option<StructOf<'v, V>>

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>

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.

Auto Trait Implementations§

§

impl<'v, V> !RefUnwindSafe for StructOf<'v, V>

§

impl<'v, V> !Send for StructOf<'v, V>

§

impl<'v, V> !Sync for StructOf<'v, V>

§

impl<'v, V> Unpin for StructOf<'v, V>
where V: Unpin,

§

impl<'v, V> !UnwindSafe for StructOf<'v, 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
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, 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.