Struct tusk_data::metadata::MetaData[][src]

pub struct MetaData {
    pub labels: Labels,
    pub tags: Tags,
}

Fields

Methods

impl MetaData
[src]

Returns a new instance of MetaData

let m = tusk_data::metadata::MetaData::new();

Adds a new tag to the MetaData

assert_eq!(tusk_data::metadata::MetaData::new()
            .add_tag("example")
            .add_tag("another_tag")
            .tags, 
        vec!("example".to_string(), "another_tag".to_string())
    );

Returns all the Tags for this piece of MetaData

assert_eq!(tusk_data::metadata::MetaData::new()
            .add_tag("example")
            .add_tag("another_tag")
            .get_tags(), 
        vec!("example".to_string(), "another_tag".to_string())
    );

Adds a new label to this piece of MetaData

let mut expect = tusk_data::metadata::Labels::new();
expect.insert("example".to_string(), "value".to_string());
assert_eq!(tusk_data::metadata::MetaData::new()
            .add_label("example", "value")
            .labels, expect);

Returns all Labels for this piece of MetaData

let mut expect = tusk_data::metadata::Labels::new();
expect.insert("example".to_string(), "value".to_string());
assert_eq!(tusk_data::metadata::MetaData::new()
            .add_label("example", "value")
            .get_labels(), expect);

Returns true if the labels of the MetaData on the LHS are a superset of the labels of the MetaData on the RHS.

let mut base = tusk_data::metadata::MetaData::new();
base.add_label("example", "value");
let mut cover = tusk_data::metadata::MetaData::new();
cover.add_label("example", "value");
cover.add_label("example2", "value2");
assert!(cover.superset(&base));
assert!(!base.superset(&cover));
// If the two are equal then they are supersets of each other
assert!(base.superset(&base));

Compiles the regexes so that the MetaData into a MetaDataFilter can be matched against other MetaData. Any failures are simply skipped over and not added to the filter.

assert_eq!(tusk_data::metadata::MetaData::new()
    .add_label("test", "value")
    .add_tag("example")
    .compile()
    .labels
    .len(), 1);
assert_eq!(tusk_data::metadata::MetaData::new()
    .add_label("test", "value")
    .add_tag("bad_tag")
    .compile()
    .tags
    .len(), 1);

Trait Implementations

impl Clone for MetaData
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for MetaData
[src]

Formats the value using the given formatter. Read more

impl Ord for MetaData
[src]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl PartialEq for MetaData
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialOrd for MetaData
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Eq for MetaData
[src]

impl Default for MetaData
[src]

Returns a default implementation of the MetaData

let m = tusk_data::metadata::MetaData::default();

Auto Trait Implementations

impl Send for MetaData

impl Sync for MetaData