Skip to main content

IdMap

Struct IdMap 

Source
pub struct IdMap<A: PartialEq + Eq + Hash + Clone> { /* private fields */ }

Implementations§

Source§

impl<A: PartialEq + Eq + Hash + Clone> IdMap<A>

Source

pub fn new() -> Self

Source§

impl<A: PartialEq + Eq + Hash + Clone> IdMap<A>

Source

pub fn from_set(id_set: IdSet, attrs: Vec<ContentAttribute<A>>) -> Self

Source

pub fn iter(&self) -> Iter<'_, A>

Source

pub fn is_empty(&self) -> bool

Source

pub fn contains(&self, id: &ID) -> bool

Source

pub fn attributions(&self, range: &BlockRange) -> Vec<AttrRange<A>>

Source

pub fn insert(&mut self, range: BlockRange, attrs: Vec<ContentAttribute<A>>)

Source

pub fn remove(&mut self, range: &BlockRange)

Source

pub fn merge_with(&mut self, other: Self)

Source

pub fn merge_many(id_maps: &[Self]) -> Self

Source

pub fn intersect_with(&mut self, other: &Self)

Source

pub fn filter<F>(&self, predicate: F) -> Self
where F: Fn(&[ContentAttribute<A>]) -> bool, A: Clone,

Source

pub fn as_id_set(&self) -> IdSet

Converts current IdMap into IdSet which has equivalent ranges, but is stripped of values. The adjacent ranges (which were separated because their values were different) will be coalesced together in the result.

Trait Implementations§

Source§

impl<A: Clone + PartialEq + Eq + Hash + Clone> Clone for IdMap<A>

Source§

fn clone(&self) -> IdMap<A>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Debug + PartialEq + Eq + Hash + Clone> Debug for IdMap<A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A: DeserializeOwned + PartialEq + Eq + Hash + Clone> Decode for IdMap<A>

Source§

fn decode<D: Decoder>(decoder: &mut D) -> Result<Self, Error>

Source§

fn decode_v1(data: &[u8]) -> Result<Self, Error>

Helper function for decoding 1st version of lib0 encoding.
Source§

fn decode_v2(data: &[u8]) -> Result<Self, Error>

Helper function for decoding 2nd version of lib0 encoding.
Source§

impl<A: PartialEq + Eq + Hash + Clone> Default for IdMap<A>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<A, U> Diff<IdMap<U>> for IdMap<A>
where A: Eq + Hash + Clone, U: Eq + Hash + Clone,

Source§

fn diff_with(&mut self, other: &IdMap<U>)

Source§

impl<A: PartialEq + Eq + Hash + Clone> Diff<IdSet> for IdMap<A>

Source§

fn diff_with(&mut self, other: &IdSet)

Source§

impl<A: Serialize + PartialEq + Eq + Hash + Clone> Encode for IdMap<A>

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encode_v1(&self) -> Vec<u8>

Helper function for encoding 1st version of lib0 encoding.
Source§

fn encode_v2(&self) -> Vec<u8>

Helper function for encoding 2nd version of lib0 encoding.
Source§

impl<A: PartialEq + Eq + Hash + Clone> From<IdMap<A>> for IdSet

Source§

fn from(value: IdMap<A>) -> Self

Converts to this type from the input type.
Source§

impl<A: PartialEq + Eq + Hash + Clone> PartialEq for IdMap<A>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<A> Freeze for IdMap<A>

§

impl<A> RefUnwindSafe for IdMap<A>
where A: RefUnwindSafe,

§

impl<A> Send for IdMap<A>
where A: Sync + Send,

§

impl<A> Sync for IdMap<A>
where A: Sync + Send,

§

impl<A> Unpin for IdMap<A>

§

impl<A> UnsafeUnpin for IdMap<A>

§

impl<A> UnwindSafe for IdMap<A>
where A: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<M> Meta for M
where M: Default,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.