You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
782 B
31 lines
782 B
use std::error::Error;
|
|
use std::fmt::{self, Display};
|
|
|
|
use crate::symbols::{Action, OwnedSymbolAction, Symbol, SymbolAction, SymbolRunner};
|
|
|
|
pub struct NoopSymbol;
|
|
|
|
impl Symbol for NoopSymbol {
|
|
fn target_reached(&self) -> Result<bool, Box<dyn Error>> {
|
|
Ok(true)
|
|
}
|
|
fn execute(&self) -> Result<(), Box<dyn Error>> {
|
|
Ok(())
|
|
}
|
|
fn as_action<'a>(&'a self, runner: &'a dyn SymbolRunner) -> Box<dyn Action + 'a> {
|
|
Box::new(SymbolAction::new(runner, self))
|
|
}
|
|
|
|
fn into_action<'a>(self: Box<Self>, runner: &'a dyn SymbolRunner) -> Box<dyn Action + 'a>
|
|
where
|
|
Self: 'a,
|
|
{
|
|
Box::new(OwnedSymbolAction::new(runner, *self))
|
|
}
|
|
}
|
|
|
|
impl Display for NoopSymbol {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
|
write!(f, "Noop")
|
|
}
|
|
}
|