pub struct MetaData {
pub labels: Labels,
pub tags: Tags,
}
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));
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);
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self | 1.21.0 [src] |
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self | 1.21.0 [src] |
Compares and returns the minimum of two values. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
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
Returns a default implementation of the MetaData
let m = tusk_data::metadata::MetaData::default();