mirror of
https://github.com/loro-dev/loro.git
synced 2025-02-08 21:47:41 +00:00
refactor: simplify type
This commit is contained in:
parent
9755782cf9
commit
cdb83c0d03
1 changed files with 3 additions and 9 deletions
|
@ -3,12 +3,7 @@ use crate::{HasLength, Rle};
|
||||||
pub(self) use bumpalo::collections::vec::Vec as BumpVec;
|
pub(self) use bumpalo::collections::vec::Vec as BumpVec;
|
||||||
use bumpalo::Bump;
|
use bumpalo::Bump;
|
||||||
use ouroboros::self_referencing;
|
use ouroboros::self_referencing;
|
||||||
use std::{
|
use std::marker::{PhantomData, PhantomPinned};
|
||||||
borrow::{Borrow, BorrowMut},
|
|
||||||
marker::{PhantomData, PhantomPinned},
|
|
||||||
pin::Pin,
|
|
||||||
ptr::NonNull,
|
|
||||||
};
|
|
||||||
use tree_trait::RleTreeTrait;
|
use tree_trait::RleTreeTrait;
|
||||||
mod iter;
|
mod iter;
|
||||||
mod node;
|
mod node;
|
||||||
|
@ -27,15 +22,14 @@ pub struct RleTreeRaw<'a, T: Rle, A: RleTreeTrait<T>> {
|
||||||
pub struct RleTree<T: Rle + 'static, A: RleTreeTrait<T> + 'static> {
|
pub struct RleTree<T: Rle + 'static, A: RleTreeTrait<T> + 'static> {
|
||||||
bump: Bump,
|
bump: Bump,
|
||||||
#[borrows(bump)]
|
#[borrows(bump)]
|
||||||
#[not_covariant]
|
tree: &'this mut RleTreeRaw<'this, T, A>,
|
||||||
tree: RleTreeRaw<'this, T, A>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Rle + 'static, A: RleTreeTrait<T> + 'static> Default for RleTree<T, A> {
|
impl<T: Rle + 'static, A: RleTreeTrait<T> + 'static> Default for RleTree<T, A> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
RleTreeBuilder {
|
RleTreeBuilder {
|
||||||
bump: Bump::new(),
|
bump: Bump::new(),
|
||||||
tree_builder: |bump| RleTreeRaw::new(bump),
|
tree_builder: |bump| bump.alloc(RleTreeRaw::new(bump)),
|
||||||
}
|
}
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue