pub trait FromArgs: Sized {
const PARAMS: Option<&'static [Param]> = None;
// Required method
fn from_args(
vm: &VirtualMachine,
args: &mut FuncArgs,
) -> Result<Self, ArgumentError>;
// Provided method
fn arity() -> RangeInclusive<usize> ⓘ { ... }
}Expand description
Implemented by any type that can be accepted as a parameter to a built-in function.
Provided Associated Constants§
Sourceconst PARAMS: Option<&'static [Param]> = None
const PARAMS: Option<&'static [Param]> = None
Parameters this type contributes to a text signature.
None: the argument is one positional-only parameter, named by the
function argument. Some(&[]): the argument contributes nothing.
Some(params): the type supplies those parameters and the argument name
is ignored.
Required Methods§
Sourcefn from_args(
vm: &VirtualMachine,
args: &mut FuncArgs,
) -> Result<Self, ArgumentError>
fn from_args( vm: &VirtualMachine, args: &mut FuncArgs, ) -> Result<Self, ArgumentError>
Extracts this item from the next argument(s).
Provided Methods§
Sourcefn arity() -> RangeInclusive<usize> ⓘ
fn arity() -> RangeInclusive<usize> ⓘ
The range of positional arguments permitted by the function signature.
Returns an empty range if not applicable.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".