Enum yrs::IndexScope
source · pub enum IndexScope {
Relative(ID),
Nested(ID),
Root(Arc<str>),
}Expand description
Struct describing context in which StickyIndex is placed. For items pointing inside of the shared typed sequence it’s always [StickyIndex::Relative] which refers to a block ID found under corresponding position.
In case when a containing collection is empty, there’s a no block ID that can be used as point of reference. In that case we store either a parent collection root type name or its branch ID instead (if collection is nested into another).
Using IDs guarantees that corresponding StickyIndex doesn’t shift under incoming concurrent updates.
Variants§
Relative(ID)
StickyIndex is relative to a given block ID. This happens whenever we set StickyIndex somewhere inside the non-empty shared collection.
Nested(ID)
If a containing collection is a nested y-type, which is empty, this case allows us to identify that nested type.
Root(Arc<str>)
If a containing collection is a root-level y-type, which is empty, this case allows us to identify that nested type.
Implementations§
source§impl IndexScope
impl IndexScope
pub fn from_branch(branch: BranchPtr) -> Self
Trait Implementations§
source§impl Clone for IndexScope
impl Clone for IndexScope
source§fn clone(&self) -> IndexScope
fn clone(&self) -> IndexScope
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for IndexScope
impl Debug for IndexScope
source§impl Decode for IndexScope
impl Decode for IndexScope
source§impl<'de> Deserialize<'de> for IndexScope
impl<'de> Deserialize<'de> for IndexScope
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Encode for IndexScope
impl Encode for IndexScope
source§impl Hash for IndexScope
impl Hash for IndexScope
source§impl Ord for IndexScope
impl Ord for IndexScope
source§fn cmp(&self, other: &IndexScope) -> Ordering
fn cmp(&self, other: &IndexScope) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for IndexScope
impl PartialEq for IndexScope
source§impl PartialOrd for IndexScope
impl PartialOrd for IndexScope
source§impl Serialize for IndexScope
impl Serialize for IndexScope
impl Eq for IndexScope
impl StructuralPartialEq for IndexScope
Auto Trait Implementations§
impl Freeze for IndexScope
impl RefUnwindSafe for IndexScope
impl Send for IndexScope
impl Sync for IndexScope
impl Unpin for IndexScope
impl UnwindSafe for IndexScope
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)