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.

31 lines
771 B

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
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<dyn Error>> {
  7. Ok(true)
  8. }
  9. fn execute(&self) -> Result<(), Box<dyn Error>> {
  10. Ok(())
  11. }
  12. fn as_action<'a>(&'a self, runner: &'a dyn SymbolRunner) -> Box<dyn Action + 'a> {
  13. Box::new(SymbolAction::new(runner, self))
  14. }
  15. fn into_action<'a>(self: Box<Self>, runner: &'a dyn SymbolRunner) -> Box<dyn Action + 'a>
  16. where
  17. Self: 'a,
  18. {
  19. Box::new(OwnedSymbolAction::new(runner, *self))
  20. }
  21. }
  22. impl Display for NoopSymbol {
  23. fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
  24. write!(f, "Noop")
  25. }
  26. }