Struct tst::TSTSet [] [src]

pub struct TSTSet { /* fields omitted */ }

A set based on a TSTMap.

Methods

impl TSTSet
[src]

[src]

Makes a new empty TSTSet.

Examples

use tst::TSTSet;

let mut s: TSTSet = TSTSet::new();

[src]

Returns the number of elements in the set.

Examples

use tst::TSTSet;

let mut s: TSTSet = TSTSet::new();
assert_eq!(s.len(), 0);
s.insert("xxx");
assert_eq!(s.len(), 1);

[src]

Returns true if the set contains no elements.

Examples

use tst::TSTSet;

let mut s: TSTSet = TSTSet::new();
assert!(s.is_empty());
s.insert("yyyx");
assert!(!s.is_empty());

[src]

Clears the set, removing all values.

Examples

use tst::TSTSet;

let mut s: TSTSet = TSTSet::new();
s.insert("abc");
s.insert("abd");
s.clear();

assert!(s.is_empty());
assert!(!s.contains("abc"));

[src]

Returns true if the set contains a key.

Examples

use tst::TSTSet;

let mut s: TSTSet = TSTSet::new();
s.insert("abc");
assert!(!s.contains("ab"));
assert!(s.contains("abc"));

[src]

Adds a value to the set.

If the set did not have a value present, true is returned.

Examples

use tst::TSTSet;

let mut s: TSTSet = TSTSet::new();

assert!(s.insert("abcd"));
assert!(!s.insert("abcd"));
assert_eq!(s.len(), 1);

[src]

Removes a value from the set. Returns true if the value was present in the set.

Examples

use tst::TSTSet;

let mut s: TSTSet = TSTSet::new();

s.insert("acde");
assert!(s.remove("acde"));
assert!(!s.remove("acde"));

[src]

Gets an iterator over the TSTSet's contents.

Examples

use tst::TSTSet;

let mut s: TSTSet = TSTSet::new();
s.insert("abc");
s.insert("bde");
s.insert("cfgx");
for x in s.iter() {
    println!("{}", x);
}

[src]

An iterator returning all nodes matching wildcard pattern. Iterator element type is (String)

Examples

use tst::TSTSet;

let mut s = TSTSet::new();
s.insert("a");
s.insert("b");
s.insert("c");

for x in s.wildcard_iter(".") {
    println!("{}", x);
}

[src]

Method returns longest prefix in the TSTSet.

Examples

use tst::TSTSet;
let mut set = TSTSet::new();
set.insert("abc");
set.insert("abcd");
set.insert("abce");
set.insert("abca");
set.insert("zxd");
set.insert("add");
set.insert("abcdef");

assert_eq!("abcd", set.longest_prefix("abcde"));

[src]

Method returns iterator over all values with common prefix in the TSTSet.

Examples

use tst::TSTSet;
let mut set = TSTSet::new();
set.insert("abc");
set.insert("abcd");
set.insert("abce");
set.insert("abca");
set.insert("zxd");
set.insert("add");
set.insert("abcdef");

for key in set.prefix_iter("abc") {
    println!("{}", key);
}

let first_key = set.iter().next().unwrap();
assert_eq!("abc".to_string(), first_key);

Trait Implementations

impl Clone for TSTSet
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq for TSTSet
[src]

[src]

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

[src]

This method tests for !=.

impl Eq for TSTSet
[src]

impl IntoIterator for TSTSet
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

[src]

Creates a consuming iterator, that is, one that moves each key-value pair out of the TSTMap in arbitrary order. The TSTMap cannot be used after calling this.

Examples

use tst::TSTSet;

let mut set = TSTSet::new();
set.insert("a");
set.insert("b");
set.insert("c");

let vec: Vec<String> = set.into_iter().collect();

impl<'x> FromIterator<&'x str> for TSTSet
[src]

[src]

Creates a value from an iterator. Read more

impl<'x> Extend<&'x str> for TSTSet
[src]

[src]

Extends a collection with the contents of an iterator. Read more

impl Default for TSTSet
[src]

[src]

Makes a new empty TSTSet.

Examples

use tst::TSTSet;

let mut s: TSTSet = TSTSet::new();

impl Debug for TSTSet
[src]

[src]

Formats the value using the given formatter.