ShapeEncoding

Struct ShapeEncoding 

Source
pub struct ShapeEncoding {
    pub seq: Vec<BitVec>,
}

Fields§

§seq: Vec<BitVec>

Implementations§

Source§

impl ShapeEncoding

Source

pub fn encode_as_shape_encoding(sampler: &Sampler) -> ShapeEncoding

Source

pub fn encode_binary_image(image: &BinaryImage) -> ShapeEncodingString

Source

pub fn encode_binary_image_as_hex_encoding_string_and_size( image: &BinaryImage, ) -> (ShapeEncodingString, usize)

Source

pub fn encode_binary_image_as_shape_encoding_and_size( image: &BinaryImage, ) -> (ShapeEncoding, usize)

Source

pub fn decode_from(shape_string: &ShapeEncodingString) -> Shape

decode shape from hexstring

Source

pub fn bits_to_binary_image(bits: &BitVec) -> BinaryImage

Source

pub fn bits_to_binary_image_with_limit( bits: &BitVec, limit: usize, ) -> BinaryImage

Source

pub fn bits(&self) -> BitVec

Source

pub fn bitstring(&self) -> ShapeEncodingString

Source

pub fn hexstring(&self) -> ShapeEncodingString

Source

pub fn hexstring_trim(&self) -> ShapeEncodingString

because hexstring may contain trailing 0s, trimming the last 4 bits would yield better prefix match

Source

pub fn hexstring_to_bits(string: &str) -> BitVec

Source

pub fn hexstring_to_bits_length(hexstring_len: usize) -> usize

Source

pub fn bitstring_to_bits(string: &str) -> BitVec

Source

pub fn bits_to_bitstring(bits: &BitVec) -> String

Source

pub fn bits_to_hexstring(bits: &BitVec) -> String

Source

pub fn pow_of_two(n: usize) -> usize

Source

pub fn pow_of_four(n: usize) -> usize

Source

pub fn is_pow_of_four(n: usize) -> bool

Source

pub fn next_pow_of_four(n: usize) -> usize

Source

pub fn layer_from_area(n: usize) -> usize

Source

pub fn length_from_area(n: usize) -> usize

Source

pub fn length_from_size(n: usize) -> usize

Source

pub fn area_from_length(length: usize) -> usize

Source

pub fn size_from_length(length: usize) -> usize

Source

pub fn size(&self) -> usize

side of the square of the image must be power of 2

Source

pub fn area(&self) -> usize

area of the image equals to size*size

Source

pub fn length(&self) -> usize

length of the shape encoding guaranteed to be smaller than (not equal to) 2*size^2

Source

pub fn shape_encoding_diff( me: &ShapeEncodingString, other: &ShapeEncodingString, ) -> u64

Source

pub fn shape_encoding_diff_bits(a: &BitVec, b: &BitVec) -> u64

Almost like humming distance between the two bit strings, but more significant bits have higher weights

Trait Implementations§

Source§

impl Default for ShapeEncoding

Source§

fn default() -> ShapeEncoding

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.