pub struct DedupEntry<K, V> {
pub key: K,
pub value: V,
}Fields§
§key: K§value: VImplementations§
Source§impl<K, V> DedupEntry<K, V>
impl<K, V> DedupEntry<K, V>
Sourcepub fn new(key: K, value: V) -> Self
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
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>
impl<K: Clone, V: Clone> Clone for DedupEntry<K, V>
Source§fn clone(&self) -> DedupEntry<K, V>
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<K: Eq, V: Eq> Eq for DedupEntry<K, V>
impl<K: PartialEq, V: PartialEq> StructuralPartialEq for DedupEntry<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for DedupEntry<K, V>
impl<K, V> RefUnwindSafe for DedupEntry<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for DedupEntry<K, V>
impl<K, V> Sync for DedupEntry<K, V>
impl<K, V> Unpin for DedupEntry<K, V>
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> 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