Struct dynarg::Args

source ·
pub struct Args<'a>(_);
Expand description

Stores an IndexMap of Args. See examples.

Implementations§

A convenience function for making a new empty Args(). In truth, it just calls default()

Initializes internal hashmap with a given capacity, to reduce required memory allocations. Potentially useful if you’re planning to call .push() a lot.

Like get(), but marks the value as used. Because it changes self, it requires mutable access to self. This, of course, may make it unusable for some use cases.

Retrieve a value by name. It’s recommended to explicitly specify type via generics, e.g.:

use dynarg::Args;
let mut args = Args::default();
args.insert_i32("meaning_of_life", 42);
let arg = args.get::<i32>("meaning_of_life");

Inserts a value with a dynamic type. Value must be wrapped in a Box<> pointer. BTW, when will the box keyword syntax be stable? That would make a lot of code more elegant.

Returns true if every argument is marked as “used”. Returns false otherwise.

Returns a iterator of arguments marked as not used.

Returns an iterator of arguments marked as used.

Resets the used status of every argument in the IndexMap.

Dynamically generated inserter

Dynamically generated getter

Dynamically generated poker

Dynamically generated inserter

Dynamically generated getter

Dynamically generated poker

Dynamically generated inserter

Dynamically generated getter

Dynamically generated poker

Dynamically generated inserter

Dynamically generated getter

Dynamically generated poker

Dynamically generated inserter

Dynamically generated getter

Dynamically generated poker

Dynamically generated inserter

Dynamically generated getter

Dynamically generated poker

Trait Implementations§

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

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.