Skip to content

Commit

Permalink
Change updates_callback: impl FnMut -> dyn FnMut
Browse files Browse the repository at this point in the history
This is part 1 of a 2-part change to improve codegen size by moving some
more pieces to dyn functions instead of generics.
  • Loading branch information
sharnoff committed Dec 12, 2022
1 parent d6d1659 commit b2fc194
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/tree/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ where
insertion_point: InsertionPoint<'t, I, S, P, M>,
slice: S,
size: I,
updates_callback: &mut impl FnMut(TraverseUpdate<I, S, P, M>),
updates_callback: &mut dyn FnMut(TraverseUpdate<I, S, P, M>),
) -> PostInsertResult<'t, C, I, S, P, M> {
match insertion_point {
// SAFETY: `do_insert_full_edge` requires that `edge_ins.new_k_idx` is less than or
Expand Down Expand Up @@ -454,7 +454,7 @@ where
insert: EdgeInsert<'t, I, S, P, M>,
slice: S,
size: I,
updates_callback: &mut impl FnMut(TraverseUpdate<I, S, P, M>),
updates_callback: &mut dyn FnMut(TraverseUpdate<I, S, P, M>),
) -> PostInsertResult<'t, C, I, S, P, M> {
unsafe { weak_assert!(insert.new_k_idx <= insert.node.leaf().len()) }

Expand Down Expand Up @@ -491,7 +491,7 @@ where
mut info: SplitKeyInsert<'t, I, S, P, M>,
slice: S,
slice_size: I,
updates_callback: &mut impl FnMut(TraverseUpdate<I, S, P, M>),
updates_callback: &mut dyn FnMut(TraverseUpdate<I, S, P, M>),
) -> PostInsertResult<'t, C, I, S, P, M> {
let key_size = info.handle.slice_size();

Expand Down Expand Up @@ -597,7 +597,7 @@ where
slice: S,
slice_size: I,
adjacent_keys: AdjacentKeys<'t, I, S, P, M>,
updates_callback: &mut impl FnMut(TraverseUpdate<I, S, P, M>),
updates_callback: &mut dyn FnMut(TraverseUpdate<I, S, P, M>),
) -> Result<PostInsertResult<'t, C, I, S, P, M>, S> {
// Broadly speaking, there's four cases here:
// 1. `slice` doesn't join with either of `adjacent_keys` -- returns Err(slice)
Expand Down Expand Up @@ -769,7 +769,7 @@ where
override_lhs_size: Option<I>,
fst: SliceSize<I, S>,
snd: Option<SliceSize<I, S>>,
updates_callback: &mut impl FnMut(TraverseUpdate<I, S, P, M>),
updates_callback: &mut dyn FnMut(TraverseUpdate<I, S, P, M>),
state_map: <BubbledInsertState<'t, C, I, S, P, M> as MapState>::Map<'m>,
) -> PostInsertResult<'t, C, I, S, P, M> {
// SAFETY: Guaranteed by caller
Expand Down Expand Up @@ -904,7 +904,7 @@ where
new_lhs_size: I,
fst: SliceSize<I, S>,
snd: Option<SliceSize<I, S>>,
updates_callback: &mut impl FnMut(TraverseUpdate<I, S, P, M>),
updates_callback: &mut dyn FnMut(TraverseUpdate<I, S, P, M>),
) -> PostInsertResult<'t, C, I, S, P, M> {
// If we're inserting to the right of the particular slice, we have to traverse down to the
// leftmost leaf in the child right of `right_of` (if it's not yet in a leaf).
Expand Down Expand Up @@ -1202,7 +1202,7 @@ where
mut override_lhs_size: Option<I>,
fst: SliceSize<I, S>,
snd: Option<SliceSize<I, S>>,
updates_callback: &mut impl FnMut(TraverseUpdate<I, S, P, M>),
updates_callback: &mut dyn FnMut(TraverseUpdate<I, S, P, M>),
) -> BubbledInsertState<'t, C, I, S, P, M> {
// There's a few cases here to determine where we split the node, depending both on
// `new_key_idx` and `node.leaf().len()`. We'll illustrate them all, pretending for now
Expand Down Expand Up @@ -1633,7 +1633,7 @@ where
override_lhs_size: Option<I>,
fst: SliceSize<I, S>,
snd: SliceSize<I, S>,
updates_callback: &mut impl FnMut(TraverseUpdate<I, S, P, M>),
updates_callback: &mut dyn FnMut(TraverseUpdate<I, S, P, M>),
) -> BubbledInsertState<'t, C, I, S, P, M> {
// SAFETY: these are all guaranteed by the caller in some form. refer to the individual
// comments for more information.
Expand Down Expand Up @@ -1757,7 +1757,7 @@ where
mut self,
store: &mut P::SliceRefStore,
mut map: <BubbledInsertState<'t, C, I, S, P, M> as MapState>::Map<'m>,
updates_callback: &mut impl FnMut(TraverseUpdate<I, S, P, M>),
updates_callback: &mut dyn FnMut(TraverseUpdate<I, S, P, M>),
early_exit: Option<&mut dyn FnMut(&OpUpdateState<'t, C, I, S, P, M>) -> ControlFlow<()>>,
) -> PostInsertResult<'t, C, I, S, P, M>
where
Expand All @@ -1779,7 +1779,7 @@ where
fn do_upward_step(
mut self,
store: &mut P::SliceRefStore,
updates_callback: &mut impl FnMut(TraverseUpdate<I, S, P, M>),
updates_callback: &mut dyn FnMut(TraverseUpdate<I, S, P, M>),
) -> BubbleStepResult<'t, C, I, S, P, M> {
let lhs_size = self.lhs.leaf().subtree_size();
let new_total_size = lhs_size
Expand Down

0 comments on commit b2fc194

Please sign in to comment.