pub struct Arg {
pub origin: Origin,
pub data: Cell,
}Expand description
A wrapper for a Cell that is intended to be an argument of a function or an operator.
Fields§
§origin: OriginThe range in the Rust or Script source code that spans the location of the argument’s application.
data: CellThe actual argument data.
Implementations§
Source§impl Arg
impl Arg
Sourcepub fn provider(&mut self) -> Provider<'_>
pub fn provider(&mut self) -> Provider<'_>
Returns a borrowed Provider of the argument’s data Cell.
This function is useful for downcasting the argument into a Rust reference:
<&usize>::downcast(origin, arg.provider()).
Note that downcasting may render the argument’s data obsolete.
Therefore, you shouldn’t use this Cell again. If needed, clone the Arg
or the data Cell of this Arg object.
Sourcepub fn into_provider<'a>(self) -> Provider<'a>
pub fn into_provider<'a>(self) -> Provider<'a>
Returns an owned Provider of the argument’s data Cell.
This function is useful for downcasting the argument into a Rust-owned data:
<usize>::downcast(origin, arg.into_provider()).
Sourcepub fn split(self) -> (Origin, Cell)
pub fn split(self) -> (Origin, Cell)
A helper function that splits an Arg into a tuple of origin and
data.
Sourcepub unsafe fn take_unchecked(arguments: &mut [Self], index: usize) -> Self
pub unsafe fn take_unchecked(arguments: &mut [Self], index: usize) -> Self
An unsafe version of the Arg::take function.
Unlike the safe take function, the take_unchecked function does not
check the arguments boundaries in production builds. As a result, it
does not panic if the index exceeds the length of the input array.
§Safety
The index must be less than arguments.len().