Skip to content

Commit

Permalink
format the codes
Browse files Browse the repository at this point in the history
Signed-off-by: Yang Keao <[email protected]>
  • Loading branch information
YangKeao committed Nov 7, 2024
1 parent 0a1c713 commit 6671dfc
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ impl<T> TempFdArray<T> {
Ok(())
}

fn try_iter<'lt>(
&'lt self,
) -> std::io::Result<impl Iterator<Item = &'lt T>> {
fn try_iter<'lt>(&'lt self) -> std::io::Result<impl Iterator<Item = &'lt T>> {
let size = BUFFER_LENGTH * self.flush_n * std::mem::size_of::<T>();

let mut file_vec = AVec::with_capacity(std::mem::size_of::<T>(), size);
Expand Down Expand Up @@ -268,13 +266,8 @@ impl<T: Hash + Eq + 'static> Collector<T> {
Ok(())
}

pub fn try_iter<'lt>(
&'lt self,
) -> std::io::Result<impl Iterator<Item = &'lt Entry<T>>> {
Ok(self
.map
.iter()
.chain(self.temp_array.try_iter()?))
pub fn try_iter<'lt>(&'lt self) -> std::io::Result<impl Iterator<Item = &'lt Entry<T>>> {
Ok(self.map.iter().chain(self.temp_array.try_iter()?))
}
}

Expand Down Expand Up @@ -393,12 +386,17 @@ mod tests {

for item in 0..(1 << 12) * 4 {
for _ in 0..(item % 4) {
collector.add(AlignTest {
a : item as u16,
b : item as u32,
c : item as u64,
d : item as u64,
}, 1).unwrap();
collector
.add(
AlignTest {
a: item as u16,
b: item as u32,
c: item as u64,
d: item as u64,
},
1,
)
.unwrap();
}
}

Expand All @@ -409,10 +407,10 @@ mod tests {
for item in 0..(1 << 12) * 4 {
let count = (item % 4) as isize;
let align_item = AlignTest {
a : item as u16,
b : item as u32,
c : item as u64,
d : item as u64,
a: item as u16,
b: item as u32,
c: item as u64,
d: item as u64,
};
match real_map.get(&align_item) {
Some(value) => {
Expand Down

0 comments on commit 6671dfc

Please sign in to comment.