pub struct NativeArgs {
pub positional: Vec<Value>,
pub named: HashMap<String, Value>,
/* private fields */
}Expand description
Argument bundle handed to a RelonFunction. Positional and named
arguments are split apart up front so each host function only inspects
what it cares about.
Fields§
§positional: Vec<Value>§named: HashMap<String, Value>Implementations§
Source§impl NativeArgs
impl NativeArgs
pub fn new(caps: Arc<dyn NativeFnCaps>) -> Self
Sourcepub fn from_evaluated(
args: Vec<EvaluatedArg>,
caps: Arc<dyn NativeFnCaps>,
) -> Self
pub fn from_evaluated( args: Vec<EvaluatedArg>, caps: Arc<dyn NativeFnCaps>, ) -> Self
Split a list of evaluated args into positional + named buckets.
pub fn from_positional( positional: Vec<Value>, caps: Arc<dyn NativeFnCaps>, ) -> Self
pub fn caps(&self) -> &dyn NativeFnCaps
Sourcepub fn into_positional(self) -> Vec<Value>
pub fn into_positional(self) -> Vec<Value>
Drop the named-argument map and yield the positional Vec<Value> —
convenient for stdlib functions that only accept positional args.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get(&self, index: usize) -> Option<&Value>
pub fn get_named(&self, name: &str) -> Option<&Value>
Trait Implementations§
Source§impl Clone for NativeArgs
impl Clone for NativeArgs
Source§fn clone(&self) -> NativeArgs
fn clone(&self) -> NativeArgs
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for NativeArgs
impl !UnwindSafe for NativeArgs
impl Freeze for NativeArgs
impl Send for NativeArgs
impl Sync for NativeArgs
impl Unpin for NativeArgs
impl UnsafeUnpin for NativeArgs
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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