Function juju::process_hooks
[−]
[src]
pub fn process_hooks(args: Vec<String>, registry: Vec<Hook>) -> Result<(), String>
Call this to process your cmd line arguments and call any needed hooks
Examples
extern crate juju; use std::env; fn config_changed()->Result<(), String>{ //Do nothing return Ok(()); } let args: Vec<String> = env::args().collect(); if args.len() > 0{ 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: Box::new(config_changed), }); let result = juju::process_hooks(args, hook_registry); if result.is_err(){ juju::log(&format!("Hook failed with error: {:?}", result.err())); } }