Struct darling_core::util::IdentString[][src]

pub struct IdentString { /* fields omitted */ }
Expand description

A wrapper for an Ident which also keeps the value as a string.

This struct can be used to perform string comparisons and operations.

Implementations

impl IdentString[src]

pub fn new(ident: Ident) -> Self[src]

Create a new IdentString.

pub fn as_ident(&self) -> &Ident[src]

Get the ident as a proc_macro2::Ident.

pub fn as_str(&self) -> &str[src]

Get the ident as a string.

pub fn span(&self) -> Span[src]

Get the location of this Ident in source.

pub fn map<F, S>(self, map_fn: F) -> Self where
    F: FnOnce(String) -> S,
    S: AsRef<str>, 
[src]

Apply some transform to the ident’s string representation.

Panics

This will panic if the transform produces an invalid ident.

Trait Implementations

impl AsRef<Ident> for IdentString[src]

fn as_ref(&self) -> &Ident[src]

Performs the conversion.

impl AsRef<str> for IdentString[src]

fn as_ref(&self) -> &str[src]

Performs the conversion.

impl Clone for IdentString[src]

fn clone(&self) -> IdentString[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for IdentString[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Display for IdentString[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl From<Ident> for IdentString[src]

fn from(ident: Ident) -> Self[src]

Performs the conversion.

impl FromMeta for IdentString[src]

fn from_meta(item: &Meta) -> Result<Self>[src]

Create an instance from a syn::Meta by dispatching to the format-appropriate trait function. This generally should not be overridden by implementers. Read more

fn from_nested_meta(item: &NestedMeta) -> Result<Self>[src]

fn from_word() -> Result<Self>[src]

Create an instance from the presence of the word in the attribute with no additional options specified. Read more

fn from_list(items: &[NestedMeta]) -> Result<Self>[src]

Create an instance from a list of nested meta items.

fn from_value(value: &Lit) -> Result<Self>[src]

Create an instance from a literal value of either foo = "bar" or foo("bar"). This dispatches to the appropriate method based on the type of literal encountered, and generally should not be overridden by implementers. Read more

fn from_char(value: char) -> Result<Self>[src]

Create an instance from a char literal in a value position.

fn from_string(value: &str) -> Result<Self>[src]

Create an instance from a string literal in a value position.

fn from_bool(value: bool) -> Result<Self>[src]

Create an instance from a bool literal in a value position.

impl Hash for IdentString[src]

fn hash<H: Hasher>(&self, state: &mut H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl Ord for IdentString[src]

fn cmp(&self, other: &IdentString) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl<'a> PartialEq<&'a str> for IdentString[src]

fn eq(&self, rhs: &&str) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialEq<IdentString> for IdentString[src]

fn eq(&self, rhs: &Self) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialEq<String> for IdentString[src]

fn eq(&self, rhs: &String) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialOrd<IdentString> for IdentString[src]

fn partial_cmp(&self, other: &IdentString) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl ToTokens for IdentString[src]

fn to_tokens(&self, tokens: &mut TokenStream)[src]

Write self to the given TokenStream. Read more

fn to_token_stream(&self) -> TokenStream[src]

Convert self directly into a TokenStream object. Read more

fn into_token_stream(self) -> TokenStream[src]

Convert self directly into a TokenStream object. Read more

impl Eq for IdentString[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Spanned for T where
    T: Spanned + ?Sized
[src]

pub fn span(&self) -> Span[src]

Returns a Span covering the complete contents of this syntax tree node, or Span::call_site() if this node is empty. Read more

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.