pub enum Position<B, I> {
Attached(AttachedPosition<B, I>),
Detached(DetachedPosition<B, I>),
}
Expand description
Descripion of a position in a tree
Tthe position can either be attached (targetting a node) or detached (outside of the tree). Positions are described by an absolute Path that cannot move above the tree root.
Variants§
Attached(AttachedPosition<B, I>)
The position is targetting a node
Detached(DetachedPosition<B, I>)
The position is leaving the tree
Implementations§
Source§impl<B, I> Position<B, I>
impl<B, I> Position<B, I>
pub fn new_detached() -> Self
pub fn new_attached(root: I) -> Self
pub fn from(path: Path<B>, idxs: Path<I>) -> Self
pub fn move_up(&mut self, up: usize) -> Option<usize>
pub fn parent(&self) -> Option<(Option<&B>, Option<&I>)>
pub fn is_attached(&self) -> bool
pub fn attached_mut(&mut self) -> Option<&mut AttachedPosition<B, I>>
pub fn detached_mut(&mut self) -> Option<&mut DetachedPosition<B, I>>
pub fn attached(&self) -> Option<&AttachedPosition<B, I>>
pub fn detached(&self) -> Option<&DetachedPosition<B, I>>
pub fn unwrap_detached(self) -> DetachedPosition<B, I>
pub fn unwrap_attached(self) -> AttachedPosition<B, I>
pub fn at(&self) -> Option<&I>
pub fn path(&self) -> &Path<B>
pub fn idxs(&self) -> &Path<I>
pub fn at_branch(&self) -> Option<&B>
Trait Implementations§
Auto Trait Implementations§
impl<B, I> Freeze for Position<B, I>
impl<B, I> RefUnwindSafe for Position<B, I>where
B: RefUnwindSafe,
I: RefUnwindSafe,
impl<B, I> Send for Position<B, I>
impl<B, I> Sync for Position<B, I>
impl<B, I> Unpin for Position<B, I>
impl<B, I> UnwindSafe for Position<B, I>where
B: UnwindSafe,
I: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more