command_listener 0.1.0

A command listener for handling commands in a Rust application
Documentation
  • Coverage
  • 0%
    0 out of 9 items documented0 out of 1 items with examples
  • Size
  • Source code size: 5.31 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.53 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • manhumor/command-listener
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • manhumor

command-listener

its a simple command listener without any specifics

default commands:

  • exit -> stops the listener
  • list -> lists all commands

usage:

use command_listener::{Command, Listener};

fn main() {
    
    println!("Hello, command-listener!");

    // creating a command
    let test_command = Command::from(
        // name
        String::from("test"),
        // description
        String::from("this is a test command"),
        // execute function
        || {
            
            println!("This is a test command!");
        }
    );
    
    // creating a listener
    let mut listener = Listener::new();
    
    // adding the command to the listener
    listener.add_command(test_command);
    
    // listening for commands
    listener.listen();
}