Function juju::process_hooks [] [src]

pub fn process_hooks(registry: Vec<Hook>) -> Result<(), String>

Call this to process your cmd line arguments and call any needed hooks

Examples

extern crate juju;
    extern crate log;

    fn config_changed()->Result<(), String>{
        //Do nothing
        return Ok(());
   }

    let mut hook_registry: Vec<juju::Hook> = Vec::new();

    //Register our hooks with the Juju library
    hook_registry.push(juju::Hook{
        name: "config-changed".to_string(),
        callback: config_changed,
    });
    let result =  juju::process_hooks(hook_registry);

    if result.is_err(){
        juju::log(&format!("Hook failed with error: {:?}", result.err()),
        Some(log::LogLevel::Error));
    }