pub struct ShapeEncoding {
pub seq: Vec<BitVec>,
}Fields§
§seq: Vec<BitVec>Implementations§
Source§impl ShapeEncoding
impl ShapeEncoding
pub fn encode_as_shape_encoding(sampler: &Sampler) -> ShapeEncoding
pub fn encode_binary_image(image: &BinaryImage) -> ShapeEncodingString
pub fn encode_binary_image_as_hex_encoding_string_and_size( image: &BinaryImage, ) -> (ShapeEncodingString, usize)
pub fn encode_binary_image_as_shape_encoding_and_size( image: &BinaryImage, ) -> (ShapeEncoding, usize)
Sourcepub fn decode_from(shape_string: &ShapeEncodingString) -> Shape
pub fn decode_from(shape_string: &ShapeEncodingString) -> Shape
decode shape from hexstring
pub fn bits_to_binary_image(bits: &BitVec) -> BinaryImage
pub fn bits_to_binary_image_with_limit( bits: &BitVec, limit: usize, ) -> BinaryImage
pub fn bits(&self) -> BitVec
pub fn bitstring(&self) -> ShapeEncodingString
pub fn hexstring(&self) -> ShapeEncodingString
Sourcepub fn hexstring_trim(&self) -> ShapeEncodingString
pub fn hexstring_trim(&self) -> ShapeEncodingString
because hexstring may contain trailing 0s, trimming the last 4 bits would yield better prefix match
pub fn hexstring_to_bits(string: &str) -> BitVec
pub fn hexstring_to_bits_length(hexstring_len: usize) -> usize
pub fn bitstring_to_bits(string: &str) -> BitVec
pub fn bits_to_bitstring(bits: &BitVec) -> String
pub fn bits_to_hexstring(bits: &BitVec) -> String
pub fn pow_of_two(n: usize) -> usize
pub fn pow_of_four(n: usize) -> usize
pub fn is_pow_of_four(n: usize) -> bool
pub fn next_pow_of_four(n: usize) -> usize
pub fn layer_from_area(n: usize) -> usize
pub fn length_from_area(n: usize) -> usize
pub fn length_from_size(n: usize) -> usize
pub fn area_from_length(length: usize) -> usize
pub fn size_from_length(length: usize) -> usize
Sourcepub fn length(&self) -> usize
pub fn length(&self) -> usize
length of the shape encoding guaranteed to be smaller than (not equal to) 2*size^2
pub fn shape_encoding_diff( me: &ShapeEncodingString, other: &ShapeEncodingString, ) -> u64
Sourcepub fn shape_encoding_diff_bits(a: &BitVec, b: &BitVec) -> u64
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
impl Default for ShapeEncoding
Source§fn default() -> ShapeEncoding
fn default() -> ShapeEncoding
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ShapeEncoding
impl RefUnwindSafe for ShapeEncoding
impl Send for ShapeEncoding
impl Sync for ShapeEncoding
impl Unpin for ShapeEncoding
impl UnwindSafe for ShapeEncoding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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