pub struct Stack {
pub nodes: Vec<SNode>,
pub extra_links: Vec<[Link; 7]>,
pub heads: Vec<Head>,
/* private fields */
}Fields§
§nodes: Vec<SNode>§extra_links: Vec<[Link; 7]>§heads: Vec<Head>Implementations§
Source§impl Stack
impl Stack
pub fn new() -> Stack
pub fn link_count(&self, node: u32) -> usize
pub fn link_at(&self, node: u32, idx: usize) -> Link
pub fn clear(&mut self)
pub fn version_count(&self) -> usize
pub fn state(&self, v: usize) -> u16
pub fn position(&self, v: usize) -> Len
pub fn depth(&self, v: usize) -> u32
pub fn is_active(&self, v: usize) -> bool
pub fn is_halted(&self, v: usize) -> bool
pub fn is_paused(&self, v: usize) -> bool
pub fn halt(&mut self, v: usize)
pub fn dynamic_precedence(&self, v: usize) -> i32
pub fn halted_count(&self) -> usize
pub fn error_cost(&self, v: usize) -> u32
pub fn node_count_since_error(&mut self, v: usize) -> u32
pub fn push( &mut self, a: &Arena, v: usize, tree: u32, pending: bool, state: u16, )
Sourcepub fn reduce_linear_pop(
&mut self,
a: &Arena,
count: u32,
trees: &mut Vec<u32>,
) -> bool
pub fn reduce_linear_pop( &mut self, a: &Arena, count: u32, trees: &mut Vec<u32>, ) -> bool
Elkhound 确定性单版本原地弹出快路径:
若当前处于单版本线性区且弹出 count 个非 extra 符号不越过 linear_base,
则直接将弹出子树按**正序(左到右)**写入 trees 并截断 self.nodes 原地回收,
无需创建临时 Head、无需逆序、无需重排版本号。若越过 linear_base 则无副作用返回 false。
pub fn can_merge(&self, v1: usize, v2: usize) -> bool
pub fn merge(&mut self, a: &Arena, v1: usize, v2: usize) -> bool
pub fn remove_version(&mut self, v: usize)
pub fn renumber_version(&mut self, v1: usize, v2: usize)
pub fn swap_versions(&mut self, v1: usize, v2: usize)
pub fn copy_version(&mut self, v: usize) -> usize
pub fn pause(&mut self, v: usize, lookahead: u32)
pub fn resume(&mut self, v: usize) -> u32
pub fn has_advanced_since_error(&self, a: &Arena, v: usize) -> bool
Sourcepub fn pop_count_fast(
&mut self,
a: &Arena,
v: usize,
count: u32,
trees: &mut Vec<u32>,
) -> Option<usize>
pub fn pop_count_fast( &mut self, a: &Arena, v: usize, count: u32, trees: &mut Vec<u32>, ) -> Option<usize>
无分叉单链快路径:沿唯一前驱走 count 步并将子树逆序写入可复用 trees,遇到分叉返回 None。
pub fn pop_count(&mut self, a: &Arena, v: usize, count: u32) -> Vec<Slice>
pub fn pop_all(&mut self, a: &Arena, v: usize) -> Vec<Slice>
pub fn pop_error(&mut self, a: &Arena, v: usize) -> Vec<u32>
pub fn record_summary(&mut self, a: &Arena, v: usize, max_depth: u32)
Trait Implementations§
Auto Trait Implementations§
impl Forget for Stack
impl Freeze for Stackwhere
*const u8 is !null: Freeze,
PhantomData<SNode>: Freeze,
PhantomData<[Link; 7]>: Freeze,
PhantomData<Head>: Freeze,
PhantomData<u32>: Freeze,
impl Move for Stack
impl RefUnwindSafe for Stack
impl Send for Stackwhere
RawVecInner: Send,
impl Sync for Stackwhere
RawVecInner: Sync,
impl Unpin for Stack
impl UnsafeUnpin for Stackwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<SNode>: UnsafeUnpin,
PhantomData<[Link; 7]>: UnsafeUnpin,
PhantomData<Head>: UnsafeUnpin,
PhantomData<u32>: UnsafeUnpin,
impl UnwindSafe for Stackwhere
RawVecInner: 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