dynfmt

Trait FormatArgs

Source
pub trait FormatArgs {
    // Provided methods
    fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()> { ... }
    fn get_key(&self, key: &str) -> Result<Option<Argument<'_>>, ()> { ... }
}
Expand description

A container that provides access to indexed or named arguments.

Instances of this trait can be used as argument lists to format calls. A container may implement either get_index, get_key or even both.

Provided Methods§

Source

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Returns the argument with the specified index.

Implement this method if the container supports indexed access. Return Ok(Some(...)) if the argument exists, or Ok(None) if the index is out of bounds.

Source

fn get_key(&self, key: &str) -> Result<Option<Argument<'_>>, ()>

Returns the argument with the given name.

Implement this method if the container supports named access. Return Ok(Some(...)) if the argument exists, or Ok(None) if the index is out of bounds.

Implementations on Foreign Types§

Source§

impl<A> FormatArgs for &A
where A: FormatArgs,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

fn get_key(&self, key: &str) -> Result<Option<Argument<'_>>, ()>

Source§

impl<S, T> FormatArgs for BTreeMap<S, T>
where S: Borrow<str> + Ord, T: Serialize,

Source§

fn get_key(&self, key: &str) -> Result<Option<Argument<'_>>, ()>

Source§

impl<S, T> FormatArgs for HashMap<S, T>
where S: Borrow<str> + Hash + Eq, T: Serialize,

Source§

fn get_key(&self, key: &str) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for &[T]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 0]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 1]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 2]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 3]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 4]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 5]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 6]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 7]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 8]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 9]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 10]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 11]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 12]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 13]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 14]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 15]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for [T; 16]
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for VecDeque<T>
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Source§

impl<T> FormatArgs for Vec<T>
where T: Serialize,

Source§

fn get_index(&self, index: usize) -> Result<Option<Argument<'_>>, ()>

Implementors§