Struct options::Options

source ·
pub struct Options(_);
Expand description

A collection of named parameters.

Implementations§

source§

impl Options

source

pub fn new() -> Options

Create a collection of named parameters.

source

pub fn get<T: Any + Clone>(&self, name: &str) -> Option<T>

Get the value of a parameter.

source

pub fn get_ref<T: Any>(&self, name: &str) -> Option<&T>

Get a reference to the value of a parameter.

source

pub fn get_mut<T: Any>(&mut self, name: &str) -> Option<&mut T>

Get a mutable reference to the value of a parameter.

source

pub fn set<'l, T: Any>(&'l mut self, name: &str, value: T) -> &'l mut Options

Set the value of a parameter.

source

pub fn has(&self, name: &str) -> bool

Check the presence of a parameter.

source

pub fn iter(&self) -> Parameters<'_>

Return an iterator over parameters.

source

pub fn iter_mut(&mut self) -> ParametersMut<'_>

Return an iterator over mutable parameters.

source

pub fn names(&self) -> Names<'_>

Return an iterator over names.

Trait Implementations§

source§

impl Debug for Options

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'l> IntoIterator for &'l Options

§

type Item = (&'l String, &'l Value)

The type of the elements being iterated over.
§

type IntoIter = Parameters<'l>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Parameters<'l>

Creates an iterator from a value. Read more
source§

impl<'l> IntoIterator for &'l mut Options

§

type Item = (&'l String, &'l mut Value)

The type of the elements being iterated over.
§

type IntoIter = ParametersMut<'l>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> ParametersMut<'l>

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Options

§

impl !Send for Options

§

impl !Sync for Options

§

impl Unpin for Options

§

impl !UnwindSafe for Options

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.