Skip to main content

Modifier

Trait Modifier 

Source
pub trait Modifier<ServerT: Server>: Send + 'static {
    // Required methods
    fn modify(self: Box<Self>, server: &mut ServerT) -> bool;
    fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>;
}
Expand description

What modifies a Server via Command::Modify.

It is Send and 'static because it’s moved accross threads, from an App to the task running the Server.

We do not use a trait like (FnOnce(&mut ServerT)) + Send + 'static, because it can not (yet) be implemented by users.

Required Methods§

Source

fn modify(self: Box<Self>, server: &mut ServerT) -> bool

Stops server, perform modification, and restarts server if true was returned.

Source

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

Trait Implementations§

Source§

impl<S: Server> Display for Box<dyn Modifier<S>>

Source§

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

Formats the value using the given formatter. Read more

Implementations on Foreign Types§

Source§

impl<S: Server, F: FnOnce(&mut S) -> bool + Send + 'static, D: Display + Send + 'static> Modifier<S> for (F, D)

Source§

fn modify(self: Box<Self>, server: &mut S) -> bool

Source§

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

Implementors§