pub struct TermDisplayContext { /* private fields */ }
Implementations§
Source§impl TermDisplayContext
impl TermDisplayContext
pub fn new(fallback: Formatter) -> Self
pub fn is_empty(&self) -> bool
pub fn all(&self) -> impl Iterator<Item = &TermDisplay>
pub fn fallback(&self) -> &FallbackFormatter
pub fn set_fallback(&mut self, formatter: FallbackFormatter)
Sourcepub fn append(
&mut self,
terms: impl Iterator<Item = TermDisplay>,
) -> Result<(), TdcError>
pub fn append( &mut self, terms: impl Iterator<Item = TermDisplay>, ) -> Result<(), TdcError>
Appends multiple TermDisplay
at once. This is more efficient than
repeatedly calling push
as matching set for all regexes is calculated
only once.
pub fn push(&mut self, term: TermDisplay) -> Result<(), TdcError>
pub fn remove(&mut self, matcher: &Matcher) -> Option<TermDisplay>
Sourcepub fn extend(&mut self, other: &Self)
pub fn extend(&mut self, other: &Self)
Extends this context with another higher priority one. If there are any
conflicts, we drop the conflicting entries from the self
context!
Sourcepub fn match_str<'a, 'b>(
&'b self,
haystack: &'a str,
children: NonMaxU32,
) -> MatchResult<'a, 'b>
pub fn match_str<'a, 'b>( &'b self, haystack: &'a str, children: NonMaxU32, ) -> MatchResult<'a, 'b>
Returns the formatter for the given string, defaulting to the fallback
if none match. See Self::match_str_opt
for more details.
Sourcepub fn match_str_opt<'a, 'b>(
&'b self,
haystack: &'a str,
children: NonMaxU32,
) -> Option<MatchResult<'a, 'b>>
pub fn match_str_opt<'a, 'b>( &'b self, haystack: &'a str, children: NonMaxU32, ) -> Option<MatchResult<'a, 'b>>
Returns the formatter for the given string, if one exists. If multiple
matchers match the string, then the first one is returned. The order is
determined as Matcher::Exact
first and then the first Matcher::Regex
in the order provided when constructing self
.
Source§impl TermDisplayContext
impl TermDisplayContext
pub fn basic() -> Self
pub fn s_expression() -> Self
Trait Implementations§
Source§impl Clone for TermDisplayContext
impl Clone for TermDisplayContext
Source§fn clone(&self) -> TermDisplayContext
fn clone(&self) -> TermDisplayContext
Returns a duplicate of the value. Read more
1.0.0 · 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 TermDisplayContext
impl Debug for TermDisplayContext
Source§impl Default for TermDisplayContext
impl Default for TermDisplayContext
Source§fn default() -> TermDisplayContext
fn default() -> TermDisplayContext
Returns the “default value” for a type. Read more
Source§impl PartialEq for TermDisplayContext
impl PartialEq for TermDisplayContext
impl Eq for TermDisplayContext
Auto Trait Implementations§
impl Freeze for TermDisplayContext
impl RefUnwindSafe for TermDisplayContext
impl Send for TermDisplayContext
impl Sync for TermDisplayContext
impl Unpin for TermDisplayContext
impl UnwindSafe for TermDisplayContext
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<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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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