Struct LitStr
pub struct LitStr { /* private fields */ }
A UTF-8 string literal: "foo".
Implementations
impl LitStr
fn new(value: &str, span: Span) -> Selffn value(&self) -> Stringfn parse<T: Parse>(&self) -> Result<T>Parse a syntax tree node from the content of this string literal.
All spans in the syntax tree will point to the span of this
LitStr.Example
use ; // Parses the path from an attribute that looks like: // // #[path = "a::b::c"] // // or returns `None` if the input is some other attribute.fn parse_with<F: Parser>(&self, parser: F) -> Result<F::Output>Invoke parser on the content of this string literal.
All spans in the syntax tree will point to the span of this
LitStr.Example
# use Span; # use ; # #fn span(&self) -> Spanfn set_span(&mut self, span: Span)fn suffix(&self) -> &strfn token(&self) -> Literal
Trait Implementations
impl Clone for LitStr
fn clone(&self) -> Self
impl Parse for LitStr
fn parse(input: ParseStream<'_>) -> Result<Self>
impl ToTokens for LitStr
fn to_tokens(&self, tokens: &mut TokenStream)
impl Token for LitStr
Auto Trait Implementations
impl !Send for LitStr
impl !Sync for LitStr
impl Freeze for LitStr
impl RefUnwindSafe for LitStr
impl Unpin for LitStr
impl UnsafeUnpin for LitStr
impl UnwindSafe for LitStr
Blanket Implementations
impl<T> Any for LitStr
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for LitStr
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for LitStr
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for LitStr
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for LitStr
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Spanned for LitStr
where
T: Spanned + ?Sized,
fn span(&self) -> Span
impl<T> ToOwned for LitStr
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for LitStr
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for LitStr
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for LitStr
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>