pub struct SegmentHash { /* private fields */ }Expand description
Hash value representing a media segment.
Implementations§
Source§impl SegmentHash
impl SegmentHash
Sourcepub fn new(data: [u8; 32], frame_count: usize) -> Self
pub fn new(data: [u8; 32], frame_count: usize) -> Self
Create a new segment hash from raw bytes and frame count.
Sourcepub fn from_bytes(bytes: &[u8], frame_count: usize) -> Self
pub fn from_bytes(bytes: &[u8], frame_count: usize) -> Self
Construct a segment hash by XOR-folding a byte slice into 32 bytes.
Sourcepub fn is_match(&self, other: &Self, max_diff_bits: u32) -> bool
pub fn is_match(&self, other: &Self, max_diff_bits: u32) -> bool
Returns true if this hash matches another within a given
Hamming-bit tolerance.
Sourcepub fn frame_count(&self) -> usize
pub fn frame_count(&self) -> usize
Returns the number of frames this hash covers.
Trait Implementations§
Source§impl Clone for SegmentHash
impl Clone for SegmentHash
Source§fn clone(&self) -> SegmentHash
fn clone(&self) -> SegmentHash
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SegmentHash
impl Debug for SegmentHash
impl Eq for SegmentHash
Source§impl Hash for SegmentHash
impl Hash for SegmentHash
Source§impl PartialEq for SegmentHash
impl PartialEq for SegmentHash
Source§fn eq(&self, other: &SegmentHash) -> bool
fn eq(&self, other: &SegmentHash) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for SegmentHash
Auto Trait Implementations§
impl Freeze for SegmentHash
impl RefUnwindSafe for SegmentHash
impl Send for SegmentHash
impl Sync for SegmentHash
impl Unpin for SegmentHash
impl UnsafeUnpin for SegmentHash
impl UnwindSafe for SegmentHash
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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