Struct litrs::StringLit [−][src]
pub struct StringLit<B: Buffer> { /* fields omitted */ }
Expand description
A string or raw string literal, e.g. "foo"
, "Grüße"
or r#"a🦊c"d🦀f"#
.
See the reference for more information.
Implementations
impl<B: Buffer> StringLit<B>
[src]
impl<B: Buffer> StringLit<B>
[src]pub fn parse(input: B) -> Result<Self, Error>
[src]
pub fn parse(input: B) -> Result<Self, Error>
[src]Parses the input as a (raw) string literal. Returns an error if the input is invalid or represents a different kind of literal.
pub fn value(&self) -> &str
[src]
pub fn value(&self) -> &str
[src]Returns the string value this literal represents (where all escapes have been turned into their respective values).
pub fn into_value(self) -> B::Cow
[src]
pub fn into_value(self) -> B::Cow
[src]Like value
but returns a potentially owned version of the value.
The return value is either Cow<'static, str>
if B = String
, or
Cow<'a, str>
if B = &'a str
.
pub fn is_raw_string(&self) -> bool
[src]
pub fn is_raw_string(&self) -> bool
[src]Returns whether this literal is a raw string literal (starting with
r
).
impl StringLit<&str>
[src]
impl StringLit<&str>
[src]pub fn into_owned(self) -> StringLit<String>
[src]
pub fn into_owned(self) -> StringLit<String>
[src]Makes a copy of the underlying buffer and returns the owned version of
Self
.
Trait Implementations
impl<B: Eq + Buffer> Eq for StringLit<B>
[src]
impl<B: Buffer> StructuralEq for StringLit<B>
[src]
impl<B: Buffer> StructuralPartialEq for StringLit<B>
[src]
Auto Trait Implementations
impl<B> RefUnwindSafe for StringLit<B> where
B: RefUnwindSafe,
B: RefUnwindSafe,
impl<B> Send for StringLit<B> where
B: Send,
B: Send,
impl<B> Sync for StringLit<B> where
B: Sync,
B: Sync,
impl<B> Unpin for StringLit<B> where
B: Unpin,
B: Unpin,
impl<B> UnwindSafe for StringLit<B> where
B: UnwindSafe,
B: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more