pub fn new_with_initvals(name: &str, instances_and_initvals: &[(&str, u64)],
        shorthelp_text: &str, longhelp_text: &str) -> Result<Self, String> {
        
        let mut instances = Vec::new();
        for &(instance, _) in instances_and_initvals.iter() {
            instances.push(instance);
        }

        let indom_helptext = format!("Instance domain for CounterVector '{}'", name);
        let indom = Indom::new(
            &instances,
            &indom_helptext, &indom_helptext
        )?;
        
        let mut im = InstanceMetric::new(
            &indom,
            name,
            0,
            Semantics::Counter,
            Unit::new().count(Count::One, 1)?,
            shorthelp_text,
            longhelp_text
        )?;

        let mut init_vals = HashMap::new();
        for &(instance, init_val) in instances_and_initvals.iter() {
            init_vals.insert(instance.to_owned(), init_val);
            im.set_val(instance, init_val).unwrap().unwrap();
        }

        Ok(CountVector {
            im: im,
            indom: indom,
            init_vals: init_vals
        })
    }
/// Creates a new count vector with given pairs of an instance and it's initial value
Creates a new count vector with given pairs of an instance and it's initial value
Creates a new count vector with given pairs of an instance and it ' s initial value
pub fn new_with_initvals(name: &str, instances_and_initvals: &[(&str, u64)],
        shorthelp_text: &str, longhelp_text: &str) -> Result<Self, String> {
        let mut instances = Vec::new();
        for &(instance, _) in instances_and_initvals.iter() {
            instances.push(instance);
        }
        let indom_helptext = format!("Instance domain for CounterVector '{}'", name);
        let indom = Indom::new(
            &instances,
            &indom_helptext, &indom_helptext
        )?;
        let mut im = InstanceMetric::new(
            &indom,
            name,
            0,
            Semantics::Counter,
            Unit::new().count(Count::One, 1)?,
            shorthelp_text,
            longhelp_text
        )?;
        let mut init_vals = HashMap::new();
        for &(instance, init_val) in instances_and_initvals.iter() {
            init_vals.insert(instance.to_owned(), init_val);
            im.set_val(instance, init_val).unwrap().unwrap();
        }
        Ok(CountVector {
            im: im,
            indom: indom,
            init_vals: init_vals
        })
    }
pub fn new_with_initvals ( name : & str , instances_and_initvals : & [ ( & str , u64 ) ] , shorthelp_text : & str , longhelp_text : & str ) -> Result < Self , String > { let mut instances = Vec :: new ( ) ; for & ( instance , _ ) in instances_and_initvals . iter ( ) { instances . push ( instance ) ; } let indom_helptext = format ! ( " " name ) ; let indom = Indom :: new ( & instances , & indom_helptext , & indom_helptext ) ? ; let mut im = InstanceMetric :: new ( & indom , name , 0 , Semantics :: Counter , Unit :: new ( ) . count ( Count :: One , 1 ) ? , shorthelp_text , longhelp_text ) ? ; let mut init_vals = HashMap :: new ( ) ; for & ( instance , init_val ) in instances_and_initvals . iter ( ) { init_vals . insert ( instance . to_owned ( ) , init_val ) ; im . set_val ( instance , init_val ) . unwrap ( ) . unwrap ( ) ; } Ok ( CountVector { im : im , indom : indom , init_vals : init_vals } ) }
Creates a new count vector with given pairs of an instance and it's initial value
Creates a new count vector with given pairs of an instance and it ' s initial value
name
&str
instances_and_initvals
&[(&str, u64)]
shorthelp_text
&str
longhelp_text
&str