Skip to main content

ToNames

Trait ToNames 

Source
pub trait ToNames: Sized {
    // Required method
    fn iter_names(&self) -> Option<impl Iterator<Item = &str>>;

    // Provided method
    fn to_names(self) -> Option<Spectrum<str>> { ... }
}
Expand description

Supporting trait for being generic over the different types that can be interpreted as names, either single or many names.

The names are given to a backend as one buffer of strings, which a served device shares in what it answers with, and which a buffer of names already given passes through untouched: names read back from a device, or listed by the database, are given again without being copied.

Supporting trait: it is only there to make this crate’s API easier to use, it is implemented for everything that API accepts and is not one to implement anywhere else.

Required Methods§

Source

fn iter_names(&self) -> Option<impl Iterator<Item = &str>>

The names, in the order they were given, absent to target all elements, borrowed where they are: what a request copies into its own parameters, once, rather than first into a buffer of their own, see Spectrum::from_strs.

Provided Methods§

Source

fn to_names(self) -> Option<Spectrum<str>>

The names as one buffer, see Self::iter_names.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ToNames for &[&str]

Source§

fn iter_names(&self) -> Option<impl Iterator<Item = &str>>

Source§

impl ToNames for &str

Source§

fn iter_names(&self) -> Option<impl Iterator<Item = &str>>

Source§

impl ToNames for (&str, &str)

Source§

fn iter_names(&self) -> Option<impl Iterator<Item = &str>>

Source§

impl ToNames for (&str, &str, &str)

Source§

fn iter_names(&self) -> Option<impl Iterator<Item = &str>>

Source§

impl ToNames for (&str, &str, &str, &str)

Source§

fn iter_names(&self) -> Option<impl Iterator<Item = &str>>

Source§

impl ToNames for (&str, &str, &str, &str, &str)

Source§

fn iter_names(&self) -> Option<impl Iterator<Item = &str>>

Source§

impl ToNames for (&str, &str, &str, &str, &str, &str)

Source§

fn iter_names(&self) -> Option<impl Iterator<Item = &str>>

Source§

impl ToNames for (&str,)

Source§

fn iter_names(&self) -> Option<impl Iterator<Item = &str>>

Source§

impl ToNames for ()

Source§

fn iter_names(&self) -> Option<impl Iterator<Item = &str>>

Source§

impl<const N: usize> ToNames for [&str; N]

Source§

fn iter_names(&self) -> Option<impl Iterator<Item = &str>>

Implementors§