Struct huffman_compress::CodeBuilder [] [src]

pub struct CodeBuilder<K: Ord + Clone, W: Saturating + Ord> { /* fields omitted */ }

Collects information about symbols and their weights used to construct a Huffman code.

Stability

The constructed code is guaranteed to be deterministic and stable across semver compatible releases if:

  • There is a strict order on the symbols K.
  • No duplicate symbols are added.

The ordering of symbols will be used to break ties when weights are equal.

Methods

impl<K: Ord + Clone, W: Saturating + Ord> CodeBuilder<K, W>
[src]

[src]

Creates a new, empty CodeBuilder<K, W>.

[src]

Creates a new, empty CodeBuilder<K, W> and preallocates space for capacity symbols.

[src]

Adds a symbol and weight pair.

[src]

Constructs a book and tree pair for encoding and decoding.

Trait Implementations

impl<K: Debug + Ord + Clone, W: Debug + Saturating + Ord> Debug for CodeBuilder<K, W>
[src]

[src]

Formats the value using the given formatter. Read more

impl<K: Clone + Ord + Clone, W: Clone + Saturating + Ord> Clone for CodeBuilder<K, W>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<K: Ord + Clone, W: Saturating + Ord> Default for CodeBuilder<K, W>
[src]

[src]

Returns the "default value" for a type. Read more

impl<K: Ord + Clone, W: Saturating + Ord> FromIterator<(K, W)> for CodeBuilder<K, W>
[src]

[src]

Creates a value from an iterator. Read more

impl<K: Ord + Clone, W: Saturating + Ord> Extend<(K, W)> for CodeBuilder<K, W>
[src]

[src]

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

impl<'a, K: Ord + Clone, W: Saturating + Ord + Clone> FromIterator<(&'a K, &'a W)> for CodeBuilder<K, W>
[src]

[src]

Creates a value from an iterator. Read more

impl<'a, K: Ord + Clone, W: Saturating + Ord + Clone> Extend<(&'a K, &'a W)> for CodeBuilder<K, W>
[src]

[src]

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

Auto Trait Implementations

impl<K, W> Send for CodeBuilder<K, W> where
    K: Send,
    W: Send

impl<K, W> Sync for CodeBuilder<K, W> where
    K: Sync,
    W: Sync