Trait oy::Interactive[][src]

pub trait Interactive: AsDebug + AsMethods + AsMethodsMut {
    fn get_field<'a>(
        &'a self,
        field_name: &'a str
    ) -> Result<'a, &dyn Interactive> { ... }
fn get_field_mut<'a>(
        &'a mut self,
        field_name: &'a str
    ) -> Result<'a, &mut dyn Interactive> { ... }
fn eval_field(
        &self,
        field_name: &str,
        f: &mut dyn FnMut(Result<'_, &dyn Debug>)
    ) { ... }
fn get_all_field_names(&self) -> &'static [&'static str] { ... } }

A trait that gives interactive access to its fields as dyn Interactive or dyn Debug.

This trait gets implemented automatically when you derive it with Interactive. See the macros documentation for more information.

Provided methods

fn get_field<'a>(&'a self, field_name: &'a str) -> Result<'a, &dyn Interactive>[src]

Looks for a field with the given name and on success return a shared reference to it.

fn get_field_mut<'a>(
    &'a mut self,
    field_name: &'a str
) -> Result<'a, &mut dyn Interactive>
[src]

Looks for a field with the given name and on success return a mutable reference to it.

fn eval_field(
    &self,
    field_name: &str,
    f: &mut dyn FnMut(Result<'_, &dyn Debug>)
)
[src]

Looks for a field with the given name, and passes it as a Ok(&dyn Debug) to the given closure.

On error the Err(InteractiveError) is passed to the closure instead.

fn get_all_field_names(&self) -> &'static [&'static str][src]

Returns all interactive field names of this type.

Can be used to drive auto-completion in a CLI.

Loading content...

Trait Implementations

impl AsDebug for &dyn Interactive[src]

impl AsDebug for &mut dyn Interactive[src]

impl AsMethods for &dyn Interactive[src]

impl AsMethods for &mut dyn Interactive[src]

impl AsMethodsMut for &mut dyn Interactive[src]

Implementations on Foreign Types

impl<'b, T: 'b + Interactive + ?Sized> Interactive for &'b T where
    &'b T: AsDebug + AsMethods + AsMethodsMut
[src]

impl<'b, T: 'b + Interactive + ?Sized> Interactive for &'b mut T where
    &'b mut T: AsDebug + AsMethods + AsMethodsMut
[src]

impl<T: Interactive + ?Sized> Interactive for Box<T> where
    Box<T>: AsDebug + AsMethods + AsMethodsMut
[src]

impl<T: Interactive + ?Sized> Interactive for Rc<T> where
    Rc<T>: AsDebug + AsMethods + AsMethodsMut
[src]

impl<T: Interactive + ?Sized> Interactive for Arc<T> where
    Arc<T>: AsDebug + AsMethods + AsMethodsMut
[src]

Loading content...

Implementors

Loading content...