Arguments

Struct Arguments 

Source
pub struct Arguments<'v, 'a>(/* private fields */);
Expand description

Arguments object is passed from the starlark interpreter to function implementation when evaluation function or method calls.

Implementations§

Source§

impl<'v, 'a> Arguments<'v, 'a>

Source

pub fn names_map(&self) -> Result<SmallMap<StringValue<'v>, Value<'v>>>

Unwrap all named arguments (both explicit and in **kwargs) into a map.

This operation fails if named argument names are not unique.

Source

pub fn len(&self) -> Result<usize>

The number of arguments, where those inside a args/kwargs are counted as multiple arguments.

This operation fails if the kwargs is not a dictionary, or args does not support len.

Source

pub fn no_positional_args(&self, heap: &'v Heap) -> Result<()>

Produce Err if there are any positional arguments.

Source

pub fn no_named_args(&self) -> Result<()>

Produce Err if there are any named (i.e. non-positional) arguments.

Source

pub fn positional1(&self, heap: &'v Heap) -> Result<Value<'v>>

Collect 1 positional arguments from the Arguments, failing if there are too many/few arguments. Ignores named arguments.

Trait Implementations§

Source§

impl<'v, 'a> Clone for Arguments<'v, 'a>

Source§

fn clone(&self) -> Arguments<'v, 'a>

Returns a duplicate 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<'v, 'a> Default for Arguments<'v, 'a>

Source§

fn default() -> Arguments<'v, 'a>

Returns the “default value” for a type. Read more
Source§

impl<'v, 'a> Dupe for Arguments<'v, 'a>

Source§

fn dupe(&self) -> Self

Auto Trait Implementations§

§

impl<'v, 'a> Freeze for Arguments<'v, 'a>

§

impl<'v, 'a> !RefUnwindSafe for Arguments<'v, 'a>

§

impl<'v, 'a> !Send for Arguments<'v, 'a>

§

impl<'v, 'a> !Sync for Arguments<'v, 'a>

§

impl<'v, 'a> Unpin for Arguments<'v, 'a>

§

impl<'v, 'a> !UnwindSafe for Arguments<'v, 'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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,

Source§

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

Source§

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

Source§

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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,