Struct sdset::set::SetBuf[][src]

pub struct SetBuf<T>(_);

An owned, set (akin to String).

Methods

impl<T> SetBuf<T>
[src]

Construct a SetBuf only if it is sorted and deduplicated.

use sdset::SetBuf;

let vec = vec![1, 2, 4, 6, 7];
let setbuf = SetBuf::new(vec)?;

// this vec is not sorted!
let vec = vec![1, 2, 4, 7, 6];
let setbuf = SetBuf::new(vec);

assert_eq!(setbuf, Err(Error::NotSort));

Construct a SetBuf without checking it.

use sdset::SetBuf;

// this vec is not sorted
let vec = vec![1, 2, 4, 7, 6];

// but we can still create a SetBuf, so be carreful!
let setbuf = SetBuf::new_unchecked(vec);

Return the Set owned by this SetBuf.

use sdset::{Set, SetBuf};

let vec = vec![1, 2, 4, 6, 7];
let setbuf = SetBuf::new(vec.clone())?;

let set = Set::new(&vec)?;
assert_eq!(setbuf.as_set(), set);

Return the Vec inside by this SetBuf.

use sdset::SetBuf;

let vec = vec![1, 2, 4, 6, 7];
let setbuf = SetBuf::new(vec)?;

let vec = setbuf.into_vec();

Methods from Deref<Target = Set<T>>

Construct the owning version of the Set.

use sdset::{Set, SetBuf};

let set = Set::new(&[1, 2, 4, 6, 7])?;
let setbuf: SetBuf<_> = set.to_set_buf();

Return the slice "inside" of this Set.

use sdset::Set;

let slice = &[1, 2, 4, 6, 7];
let set = Set::new(slice)?;

assert_eq!(set.as_slice(), slice);

Trait Implementations

impl<T: Debug> Debug for SetBuf<T>
[src]

Formats the value using the given formatter. Read more

impl<T: Clone> Clone for SetBuf<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: PartialEq> PartialEq for SetBuf<T>
[src]

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

This method tests for !=.

impl<T: Eq> Eq for SetBuf<T>
[src]

impl<T: PartialOrd> PartialOrd for SetBuf<T>
[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<T: Ord> Ord for SetBuf<T>
[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<T: Hash> Hash for SetBuf<T>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<T> Deref for SetBuf<T>
[src]

The resulting type after dereferencing.

Dereferences the value.

impl<T> AsRef<Set<T>> for SetBuf<T>
[src]

Performs the conversion.

impl<T> AsRef<[T]> for SetBuf<T>
[src]

Performs the conversion.

Auto Trait Implementations

impl<T> Send for SetBuf<T> where
    T: Send

impl<T> Sync for SetBuf<T> where
    T: Sync