pub struct ComparisonBatch {
pub n_pairs: usize,
pub n_fields: usize,
pub pair_ids: Vec<(u64, u64)>,
pub levels: Vec<u8>,
}Expand description
Field-major SoA batch of comparison results for many pairs.
§Layout
levels[field_idx * n_pairs + pair_idx] = ComparisonLevel as u8All values for field 0 across every pair are contiguous, then field 1, etc.
Fields§
§n_pairs: usize§n_fields: usize§pair_ids: Vec<(u64, u64)>(record_a_id, record_b_id) for pair p.
levels: Vec<u8>Field-major levels: levels[f * n_pairs + p].
Implementations§
Source§impl ComparisonBatch
impl ComparisonBatch
Sourcepub fn new(
n_pairs: usize,
n_fields: usize,
pair_ids: Vec<(u64, u64)>,
) -> ComparisonBatch
pub fn new( n_pairs: usize, n_fields: usize, pair_ids: Vec<(u64, u64)>, ) -> ComparisonBatch
Allocate a zeroed batch (all levels = ComparisonLevel::None).
Sourcepub fn level(&self, field: usize, pair: usize) -> ComparisonLevel
pub fn level(&self, field: usize, pair: usize) -> ComparisonLevel
Read the level for (field, pair).
Sourcepub fn set_level(&mut self, field: usize, pair: usize, level: ComparisonLevel)
pub fn set_level(&mut self, field: usize, pair: usize, level: ComparisonLevel)
Write the level for (field, pair).
Sourcepub fn pair_as_vector(&self, pair_idx: usize) -> ComparisonVector
pub fn pair_as_vector(&self, pair_idx: usize) -> ComparisonVector
Reconstruct a ComparisonVector for pair p.
Sourcepub fn from_vectors(vectors: &[ComparisonVector]) -> ComparisonBatch
pub fn from_vectors(vectors: &[ComparisonVector]) -> ComparisonBatch
Build from an existing Vec<ComparisonVector> for migration / tests.
Sourcepub fn into_vectors(&self) -> Vec<ComparisonVector>
pub fn into_vectors(&self) -> Vec<ComparisonVector>
Convert back to Vec<ComparisonVector> for callers that still need it.
Sourcepub fn concat(chunks: &[ComparisonBatch]) -> ComparisonBatch
pub fn concat(chunks: &[ComparisonBatch]) -> ComparisonBatch
Concatenate multiple field-major batches (same n_fields) into one.
Each chunk may have a different n_pairs. The merged layout remains
field-major with n_pairs_total = sum of all chunk n_pairs.
Trait Implementations§
Source§impl Clone for ComparisonBatch
impl Clone for ComparisonBatch
Source§fn clone(&self) -> ComparisonBatch
fn clone(&self) -> ComparisonBatch
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 ComparisonBatch
impl Debug for ComparisonBatch
Source§impl<'de> Deserialize<'de> for ComparisonBatch
impl<'de> Deserialize<'de> for ComparisonBatch
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ComparisonBatch, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ComparisonBatch, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ComparisonBatch
impl Serialize for ComparisonBatch
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ComparisonBatch
impl RefUnwindSafe for ComparisonBatch
impl Send for ComparisonBatch
impl Sync for ComparisonBatch
impl Unpin for ComparisonBatch
impl UnsafeUnpin for ComparisonBatch
impl UnwindSafe for ComparisonBatch
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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