pub struct DecoratorSet { /* private fields */ }Expand description
An immutable set of decorators.
The decorators of a level compose in a defined order, by order and then
by id, each one decorating what the one before it produced;
DecoratorSet::add and DecoratorSet::remove return new sets, so
removing a decorator gives exactly the output of the set without it.
Implementations§
Source§impl DecoratorSet
impl DecoratorSet
Sourcepub fn new(decorators: Vec<Decorator>) -> Result<Self, DecoratorError>
pub fn new(decorators: Vec<Decorator>) -> Result<Self, DecoratorError>
A set of decorators, sorted by order and then by id.
§Errors
A DecoratorError when two decorators share an id.
Sourcepub fn from_lino(text: &str) -> Result<Self, DecoratorError>
pub fn from_lino(text: &str) -> Result<Self, DecoratorError>
Reads the decorators of a Links Notation document (see
DecoratorSet::to_lino).
§Errors
A DecoratorError for text that is not Links Notation or a
statement that is not a valid decorator.
Sourcepub fn decorators(&self) -> &[Decorator]
pub fn decorators(&self) -> &[Decorator]
The decorators, in the order they compose.
Sourcepub fn add(
&self,
decorators: impl IntoIterator<Item = Decorator>,
) -> Result<Self, DecoratorError>
pub fn add( &self, decorators: impl IntoIterator<Item = Decorator>, ) -> Result<Self, DecoratorError>
Sourcepub fn remove(&self, id: &str) -> Result<Self, DecoratorError>
pub fn remove(&self, id: &str) -> Result<Self, DecoratorError>
Sourcepub fn for_level(
&self,
level: DecoratorLevel,
) -> impl Iterator<Item = &Decorator>
pub fn for_level( &self, level: DecoratorLevel, ) -> impl Iterator<Item = &Decorator>
The decorators of level, in the order they compose.
Sourcepub fn has(&self, level: DecoratorLevel) -> bool
pub fn has(&self, level: DecoratorLevel) -> bool
Whether the set has a decorator of level.
Sourcepub fn decorate(
&self,
level: DecoratorLevel,
record: &DecoratorRecord,
) -> Option<DecoratorRecord>
pub fn decorate( &self, level: DecoratorLevel, record: &DecoratorRecord, ) -> Option<DecoratorRecord>
The record the decorators of level make of record, or None when
one of them drops it. A missing field reads as empty text.
Sourcepub fn decorate_all(
&self,
level: DecoratorLevel,
records: &[DecoratorRecord],
) -> Vec<DecoratorRecord> ⓘ
pub fn decorate_all( &self, level: DecoratorLevel, records: &[DecoratorRecord], ) -> Vec<DecoratorRecord> ⓘ
Decorates every record of records, leaving out the dropped ones.
Trait Implementations§
Source§impl Clone for DecoratorSet
impl Clone for DecoratorSet
Source§fn clone(&self) -> DecoratorSet
fn clone(&self) -> DecoratorSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DecoratorSet
impl Debug for DecoratorSet
Source§impl Default for DecoratorSet
impl Default for DecoratorSet
Source§fn default() -> DecoratorSet
fn default() -> DecoratorSet
impl Eq for DecoratorSet
Source§impl PartialEq for DecoratorSet
impl PartialEq for DecoratorSet
impl StructuralPartialEq for DecoratorSet
Auto Trait Implementations§
impl Freeze for DecoratorSet
impl RefUnwindSafe for DecoratorSet
impl Send for DecoratorSet
impl Sync for DecoratorSet
impl Unpin for DecoratorSet
impl UnsafeUnpin for DecoratorSet
impl UnwindSafe for DecoratorSet
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> ⓘ
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> ⓘ
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