[][src]Struct lzjd::lz_dict::LZDict

pub struct LZDict { /* fields omitted */ }

A sorted list of the k smallest LZSet hashes

Methods

impl LZDict[src]

pub fn from_base64_string(b64: &str) -> Result<Self>[src]

Converts a base64 string into a Vec and wraps a LZDict around it.

pub fn from_bytes_stream_lz78<I, H>(seq_iter: I, build_hasher: &H) -> Self where
    I: Iterator<Item = u8>,
    H: BuildHasher
[src]

Creates a LZ dictionary containing the smallest k hashes of LZ sequences obtained from seq_iter. Based on LZ78 as described in https://en.wikipedia.org/wiki/LZ77_and_LZ78#LZ78

pub fn from_bytes_stream<I, H>(seq_iter: I, build_hasher: &H) -> Self where
    I: Iterator<Item = u8>,
    H: BuildHasher
[src]

pub fn jaccard_similarity(&self, other: &Self) -> f64[src]

Calculates the jaccard similarity of the entries two dictionaries which is defined as the length of the intersection over the length of the union.

pub fn to_string(&self) -> String[src]

Encodes the contents of the dictionary to base64 and returns it as a string.

pub fn dist(&self, other: &LZDict) -> f64[src]

Calculates the LZ-distance of two LZ Dictionaries

pub fn similarity(&self, other: &LZDict) -> f64[src]

Calculates the LZ-similarity of two LZ Dictionaries

Methods from Deref<Target = Vec<i32>>

pub fn capacity(&self) -> usize1.0.0[src]

Returns the number of elements the vector can hold without reallocating.

Examples

let vec: Vec<i32> = Vec::with_capacity(10);
assert_eq!(vec.capacity(), 10);

pub fn as_slice(&self) -> &[T]1.7.0[src]

Extracts a slice containing the entire vector.

Equivalent to &s[..].

Examples

use std::io::{self, Write};
let buffer = vec![1, 2, 3, 5, 8];
io::sink().write(buffer.as_slice()).unwrap();

pub fn as_ptr(&self) -> *const T1.37.0[src]

Returns a raw pointer to the vector's buffer.

The caller must ensure that the vector outlives the pointer this function returns, or else it will end up pointing to garbage. Modifying the vector may cause its buffer to be reallocated, which would also make any pointers to it invalid.

The caller must also ensure that the memory the pointer (non-transitively) points to is never written to (except inside an UnsafeCell) using this pointer or any pointer derived from it. If you need to mutate the contents of the slice, use as_mut_ptr.

Examples

let x = vec![1, 2, 4];
let x_ptr = x.as_ptr();

unsafe {
    for i in 0..x.len() {
        assert_eq!(*x_ptr.add(i), 1 << i);
    }
}

pub fn len(&self) -> usize1.0.0[src]

Returns the number of elements in the vector, also referred to as its 'length'.

Examples

let a = vec![1, 2, 3];
assert_eq!(a.len(), 3);

pub fn is_empty(&self) -> bool1.0.0[src]

Returns true if the vector contains no elements.

Examples

let mut v = Vec::new();
assert!(v.is_empty());

v.push(1);
assert!(!v.is_empty());

Trait Implementations

impl From<Vec<i32>> for LZDict[src]

impl From<LZDict> for Vec<i32>[src]

impl Deref for LZDict[src]

type Target = Vec<i32>

The resulting type after dereferencing.

impl Debug for LZDict[src]

Auto Trait Implementations

impl Send for LZDict

impl Unpin for LZDict

impl Sync for LZDict

impl UnwindSafe for LZDict

impl RefUnwindSafe for LZDict

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]