Struct litrs::ByteStringLit [−][src]
pub struct ByteStringLit<B: Buffer> { /* fields omitted */ }
Expand description
A byte string or raw byte string literal, e.g. b"hello" or br#"abc"def"#.
See the reference for more information.
Implementations
impl<B: Buffer> ByteStringLit<B>[src]
impl<B: Buffer> ByteStringLit<B>[src]pub fn parse(input: B) -> Result<Self, ParseError>[src]
pub fn parse(input: B) -> Result<Self, ParseError>[src]Parses the input as a (raw) byte string literal. Returns an error if the input is invalid or represents a different kind of literal.
pub fn value(&self) -> &[u8][src]
pub fn value(&self) -> &[u8][src]Returns the string value this literal represents (where all escapes have been turned into their respective values).
pub fn into_value(self) -> B::ByteCow[src]
pub fn into_value(self) -> B::ByteCow[src]Like value but returns a potentially owned version of the value.
The return value is either Cow<'static, [u8]> if B = String, or
Cow<'a, [u8]> if B = &'a str.
pub fn is_raw_byte_string(&self) -> bool[src]
pub fn is_raw_byte_string(&self) -> bool[src]Returns whether this literal is a raw string literal (starting with
r).
impl ByteStringLit<&str>[src]
impl ByteStringLit<&str>[src]pub fn into_owned(self) -> ByteStringLit<String>[src]
pub fn into_owned(self) -> ByteStringLit<String>[src]Makes a copy of the underlying buffer and returns the owned version of
Self.
Trait Implementations
impl<B: Clone + Buffer> Clone for ByteStringLit<B>[src]
impl<B: Clone + Buffer> Clone for ByteStringLit<B>[src]fn clone(&self) -> ByteStringLit<B>[src]
fn clone(&self) -> ByteStringLit<B>[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]Performs copy-assignment from source. Read more
impl<B: Debug + Buffer> Debug for ByteStringLit<B>[src]
impl<B: Debug + Buffer> Debug for ByteStringLit<B>[src]impl<B: Buffer> Display for ByteStringLit<B>[src]
impl<B: Buffer> Display for ByteStringLit<B>[src]impl<B: Buffer> From<ByteStringLit<B>> for Literal<B>[src]
impl<B: Buffer> From<ByteStringLit<B>> for Literal<B>[src]fn from(src: ByteStringLit<B>) -> Self[src]
fn from(src: ByteStringLit<B>) -> Self[src]Performs the conversion.
impl<B: PartialEq + Buffer> PartialEq<ByteStringLit<B>> for ByteStringLit<B>[src]
impl<B: PartialEq + Buffer> PartialEq<ByteStringLit<B>> for ByteStringLit<B>[src]fn eq(&self, other: &ByteStringLit<B>) -> bool[src]
fn eq(&self, other: &ByteStringLit<B>) -> bool[src]This method tests for self and other values to be equal, and is used
by ==. Read more
fn ne(&self, other: &ByteStringLit<B>) -> bool[src]
fn ne(&self, other: &ByteStringLit<B>) -> bool[src]This method tests for !=.
impl TryFrom<&'_ Literal> for ByteStringLit<String>[src]
impl TryFrom<&'_ Literal> for ByteStringLit<String>[src]impl TryFrom<&'_ Literal> for ByteStringLit<String>[src]
impl TryFrom<&'_ Literal> for ByteStringLit<String>[src]impl TryFrom<&'_ TokenTree> for ByteStringLit<String>[src]
impl TryFrom<&'_ TokenTree> for ByteStringLit<String>[src]impl TryFrom<&'_ TokenTree> for ByteStringLit<String>[src]
impl TryFrom<&'_ TokenTree> for ByteStringLit<String>[src]impl TryFrom<Literal> for ByteStringLit<String>[src]
impl TryFrom<Literal> for ByteStringLit<String>[src]impl TryFrom<Literal> for ByteStringLit<String>[src]
impl TryFrom<Literal> for ByteStringLit<String>[src]impl TryFrom<TokenTree> for ByteStringLit<String>[src]
impl TryFrom<TokenTree> for ByteStringLit<String>[src]impl TryFrom<TokenTree> for ByteStringLit<String>[src]
impl TryFrom<TokenTree> for ByteStringLit<String>[src]impl<B: Eq + Buffer> Eq for ByteStringLit<B>[src]
impl<B: Buffer> StructuralEq for ByteStringLit<B>[src]
impl<B: Buffer> StructuralPartialEq for ByteStringLit<B>[src]
Auto Trait Implementations
impl<B> RefUnwindSafe for ByteStringLit<B> where
B: RefUnwindSafe,
B: RefUnwindSafe,
impl<B> Send for ByteStringLit<B> where
B: Send,
B: Send,
impl<B> Sync for ByteStringLit<B> where
B: Sync,
B: Sync,
impl<B> Unpin for ByteStringLit<B> where
B: Unpin,
B: Unpin,
impl<B> UnwindSafe for ByteStringLit<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 = TThe 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