Skip to main content

DedupEntry

Struct DedupEntry 

Source
pub struct DedupEntry<K, V> {
    pub key: K,
    pub value: V,
}

Fields§

§key: K§value: V

Implementations§

Source§

impl<K, V> DedupEntry<K, V>

Source

pub fn new(key: K, value: V) -> Self

Examples found in repository?
examples/perf_features.rs (line 466)
459fn dedup_streams(n: usize) -> Vec<std::vec::IntoIter<DedupEntry<u64, u64>>> {
460    let per = n / STREAMS;
461    (0..STREAMS)
462        .map(|s| {
463            (0..per)
464                .map(move |i| {
465                    let key = ((s + i * STREAMS) as u64) / 2;
466                    DedupEntry::new(key, key)
467                })
468                .collect::<Vec<_>>()
469                .into_iter()
470        })
471        .collect()
472}
More examples
Hide additional examples
examples/sample_app.rs (line 189)
184fn compact_last_prices() {
185    use subms_merge_iterator::{DedupEntry, DedupMergeIterator};
186    println!("\n== dedup: compact the last-price rows ==");
187    let flushed = PRICE_FLUSHED
188        .iter()
189        .map(|&(k, v)| DedupEntry::new(k, v))
190        .collect::<Vec<_>>();
191    let memtable = PRICE_MEMTABLE
192        .iter()
193        .map(|&(k, v)| DedupEntry::new(k, v))
194        .collect::<Vec<_>>();
195
196    let compacted: Vec<(&str, i64)> =
197        DedupMergeIterator::new([flushed.into_iter(), memtable.into_iter()])
198            .map(|e| (e.key, e.value))
199            .collect();
200    println!("  compacted last prices: {compacted:?}");
201    assert_eq!(compacted, vec![("AAPL", 152), ("MSFT", 300)]);
202}

Trait Implementations§

Source§

impl<K: Clone, V: Clone> Clone for DedupEntry<K, V>

Source§

fn clone(&self) -> DedupEntry<K, V>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K: Debug, V: Debug> Debug for DedupEntry<K, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K: Eq, V: Eq> Eq for DedupEntry<K, V>

Source§

impl<K: PartialEq, V: PartialEq> PartialEq for DedupEntry<K, V>

Source§

fn eq(&self, other: &DedupEntry<K, V>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<K: PartialEq, V: PartialEq> StructuralPartialEq for DedupEntry<K, V>

Auto Trait Implementations§

§

impl<K, V> Freeze for DedupEntry<K, V>
where K: Freeze, V: Freeze,

§

impl<K, V> RefUnwindSafe for DedupEntry<K, V>

§

impl<K, V> Send for DedupEntry<K, V>
where K: Send, V: Send,

§

impl<K, V> Sync for DedupEntry<K, V>
where K: Sync, V: Sync,

§

impl<K, V> Unpin for DedupEntry<K, V>
where K: Unpin, V: Unpin,

§

impl<K, V> UnsafeUnpin for DedupEntry<K, V>
where K: UnsafeUnpin, V: UnsafeUnpin,

§

impl<K, V> UnwindSafe for DedupEntry<K, V>
where K: UnwindSafe, V: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.