pub struct DocumentMarks(/* private fields */);Expand description
Every mark supplied to one export, keyed by name.
A BTreeMap for the same reason DocumentComments
is one: two exports of the same document must be byte-comparable, and a randomised iteration
order would quietly break that. Keying by name also makes the uniqueness the formats require
structural — a bookmark name may appear only once in a document, and a Vec would let a
caller supply the same name twice and produce a file neither editor can open cleanly.
Implementations§
Source§impl DocumentMarks
impl DocumentMarks
pub fn new() -> DocumentMarks
Sourcepub fn insert(&mut self, mark: DocumentMark) -> &mut DocumentMarks
pub fn insert(&mut self, mark: DocumentMark) -> &mut DocumentMarks
Register a mark, keyed by its own name. A second insert under the same name replaces the first.
pub fn get(&self, name: &str) -> Option<&DocumentMark>
pub fn iter(&self) -> impl Iterator<Item = &DocumentMark>
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Sourcepub fn in_document_order(&self) -> Vec<&DocumentMark>
pub fn in_document_order(&self) -> Vec<&DocumentMark>
Every mark, sorted by (start, end, name) — the order a writer walking the document
front-to-back opens and closes them in. name breaks an exact positional tie
deterministically.
Trait Implementations§
Source§impl Clone for DocumentMarks
impl Clone for DocumentMarks
Source§fn clone(&self) -> DocumentMarks
fn clone(&self) -> DocumentMarks
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DocumentMarks
impl Debug for DocumentMarks
Source§impl Default for DocumentMarks
impl Default for DocumentMarks
Source§fn default() -> DocumentMarks
fn default() -> DocumentMarks
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DocumentMarks
impl<'de> Deserialize<'de> for DocumentMarks
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DocumentMarks, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DocumentMarks, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for DocumentMarks
Source§impl PartialEq for DocumentMarks
impl PartialEq for DocumentMarks
Source§impl Serialize for DocumentMarks
impl Serialize for DocumentMarks
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for DocumentMarks
Auto Trait Implementations§
impl Freeze for DocumentMarks
impl RefUnwindSafe for DocumentMarks
impl Send for DocumentMarks
impl Sync for DocumentMarks
impl Unpin for DocumentMarks
impl UnsafeUnpin for DocumentMarks
impl UnwindSafe for DocumentMarks
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.