A library for writing host-specific, single-binary configuration management and deployment tools
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.

29 lines
738 B

5 years ago
  1. use std::error::Error;
  2. use std::fmt::{self, Display};
  3. use symbols::{Action, OwnedSymbolAction, Symbol, SymbolAction, SymbolRunner};
  4. pub struct NoopSymbol;
  5. impl Symbol for NoopSymbol {
  6. fn target_reached(&self) -> Result<bool, Box<Error>> {
  7. Ok(true)
  8. }
  9. fn execute(&self) -> Result<(), Box<Error>> {
  10. Ok(())
  11. }
  12. fn as_action<'a>(&'a self, runner: &'a SymbolRunner) -> Box<Action + 'a> {
  13. Box::new(SymbolAction::new(runner, self))
  14. }
  15. fn into_action<'a>(self: Box<Self>, runner: &'a SymbolRunner) -> Box<Action + 'a> where Self: 'a {
  16. Box::new(OwnedSymbolAction::new(runner, *self))
  17. }
  18. }
  19. impl Display for NoopSymbol {
  20. fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error>{
  21. write!(f, "Noop")
  22. }
  23. }