Skip to content

Commit

Permalink
Initial lib.rs and cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
eggyal committed Dec 31, 2022
1 parent c4206b3 commit b1d561d
Show file tree
Hide file tree
Showing 18 changed files with 797 additions and 212 deletions.
8 changes: 7 additions & 1 deletion src/btree/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ impl<'a, T> DormantMutRef<'a, T> {
// SAFETY: we hold the borrow throughout 'a via `_marker`, and we expose
// only this reference, so it is unique.
let new_ref = unsafe { &mut *ptr.as_ptr() };
(new_ref, Self { ptr, _marker: PhantomData })
(
new_ref,
Self {
ptr,
_marker: PhantomData,
},
)
}

/// Revert to the unique borrow initially captured.
Expand Down
4 changes: 3 additions & 1 deletion src/btree/dedup_sorted_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ where
I: Iterator<Item = (K, V)>,
{
pub fn new(iter: I) -> Self {
Self { iter: iter.peekable() }
Self {
iter: iter.peekable(),
}
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/btree/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ impl<K, V> Root<K, V> {
pub fn fix_right_border<A: Allocator + Clone>(&mut self, alloc: A) {
self.fix_top(alloc.clone());
if self.len() > 0 {
self.borrow_mut().last_kv().fix_right_border_of_right_edge(alloc.clone());
self.borrow_mut()
.last_kv()
.fix_right_border_of_right_edge(alloc.clone());
self.fix_top(alloc);
}
}
Expand All @@ -88,7 +90,9 @@ impl<K, V> Root<K, V> {
pub fn fix_left_border<A: Allocator + Clone>(&mut self, alloc: A) {
self.fix_top(alloc.clone());
if self.len() > 0 {
self.borrow_mut().first_kv().fix_left_border_of_left_edge(alloc.clone());
self.borrow_mut()
.first_kv()
.fix_left_border_of_left_edge(alloc.clone());
self.fix_top(alloc);
}
}
Expand Down
Loading

0 comments on commit b1d561d

Please sign in to comment.