pub struct Literal(/* private fields */);Expand description
A literal value in a glob expression
Implementations§
Source§impl Literal
impl Literal
Sourcepub fn from_text(text: impl Into<String>) -> Self
pub fn from_text(text: impl Into<String>) -> Self
Create a literal with the specified text
This implicitly escapes special characters.
Sourcepub fn text(&self) -> &str
pub fn text(&self) -> &str
Return the underlying text value
Compared to Self::equivalent_expr,
this method interprets escape sequences.
Sourcepub fn equivalent_expr(&self) -> String
pub fn equivalent_expr(&self) -> String
Return an equivalent expression that will parse to the same value.
See also: GlobExpr::equivalent_expr
Sourcepub fn escape(text: &str) -> String
pub fn escape(text: &str) -> String
Escape any special characters in the specified text, returning an equivalent expression
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Literal
impl RefUnwindSafe for Literal
impl Send for Literal
impl Sync for Literal
impl Unpin for Literal
impl UnwindSafe for Literal
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<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