Skip to main content

ToNamesSpec

Trait ToNamesSpec 

Source
pub trait ToNamesSpec<T>: ToNames {
    type Output;

    // Required method
    fn collect(entries: Vec<NamedResult<T>>) -> Result<Self::Output>;
}
Expand description

Generic specification type used for command and attribute info, as there is no special processing to do on the resulted value! This is an extension to the ToNames, because this spec’s output only depends on the actual type of the names we give.

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 Associated Types§

Source

type Output

The final type of the output.

Required Methods§

Source

fn collect(entries: Vec<NamedResult<T>>) -> Result<Self::Output>

Build the output out of the entries the device answered with, one per name.

The shape of the output is what the names that were given say it is, which is what this is implemented on.

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<T, const N: usize> ToNamesSpec<T> for [&str; N]

Source§

type Output = [Result<T, Error>; N]

Source§

fn collect(entries: Vec<NamedResult<T>>) -> Result<Self::Output>

Source§

impl<T> ToNamesSpec<T> for &[&str]

Source§

type Output = Vec<Result<T, Error>>

Source§

fn collect(entries: Vec<NamedResult<T>>) -> Result<Self::Output>

Source§

impl<T> ToNamesSpec<T> for &str

One name, one entry: that entry is the output, and its failure is the output’s own since there is no slot of its own to carry it in.

Source§

type Output = T

Source§

fn collect(entries: Vec<NamedResult<T>>) -> Result<Self::Output>

Source§

impl<T> ToNamesSpec<T> for (&str, &str)

Source§

type Output = (Result<T, Error>, Result<T, Error>)

Source§

fn collect(entries: Vec<NamedResult<T>>) -> Result<Self::Output>

Source§

impl<T> ToNamesSpec<T> for (&str, &str, &str)

Source§

type Output = (Result<T, Error>, Result<T, Error>, Result<T, Error>)

Source§

fn collect(entries: Vec<NamedResult<T>>) -> Result<Self::Output>

Source§

impl<T> ToNamesSpec<T> for (&str, &str, &str, &str)

Source§

type Output = (Result<T, Error>, Result<T, Error>, Result<T, Error>, Result<T, Error>)

Source§

fn collect(entries: Vec<NamedResult<T>>) -> Result<Self::Output>

Source§

impl<T> ToNamesSpec<T> for (&str, &str, &str, &str, &str)

Source§

type Output = (Result<T, Error>, Result<T, Error>, Result<T, Error>, Result<T, Error>, Result<T, Error>)

Source§

fn collect(entries: Vec<NamedResult<T>>) -> Result<Self::Output>

Source§

impl<T> ToNamesSpec<T> for (&str, &str, &str, &str, &str, &str)

Source§

type Output = (Result<T, Error>, Result<T, Error>, Result<T, Error>, Result<T, Error>, Result<T, Error>, Result<T, Error>)

Source§

fn collect(entries: Vec<NamedResult<T>>) -> Result<Self::Output>

Source§

impl<T> ToNamesSpec<T> for (&str,)

Source§

type Output = (Result<T, Error>,)

Source§

fn collect(entries: Vec<NamedResult<T>>) -> Result<Self::Output>

Implementors§