pub struct IdentStr(_);
Expand description

A borrowed identifier.

For more details, see the module level documentation.

Implementations§

§

impl IdentStr

pub fn new(s: &str) -> Result<&IdentStr, Error>

pub fn is_valid(s: impl AsRef<str>) -> bool

Returns true if this string is a valid identifier.

pub fn len(&self) -> usize

Returns the length of self in bytes.

pub fn is_empty(&self) -> bool

Returns true if self has a length of zero bytes.

pub fn as_str(&self) -> &str

Converts self to a &str.

This is not implemented as a From trait to discourage automatic conversions – these conversions should not typically happen.

pub fn as_bytes(&self) -> &[u8]

Converts self to a byte slice.

Trait Implementations§

§

impl AsRef<IdentStr> for Identifier

§

fn as_ref(&self) -> &IdentStr

Converts this type into a shared reference of the (usually inferred) input type.
§

impl Borrow<IdentStr> for Identifier

§

fn borrow(&self) -> &IdentStr

Immutably borrows from an owned value. Read more
§

impl Debug for IdentStr

§

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

Formats the value using the given formatter. Read more
§

impl Display for IdentStr

§

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

Formats the value using the given formatter. Read more
§

impl From<&IdentStr> for Identifier

§

fn from(ident_str: &IdentStr) -> Identifier

Converts to this type from the input type.
§

impl Hash for IdentStr

§

fn hash<__H>(&self, state: &mut __H)where __H: Hasher,

Feeds this value into the given Hasher. Read more
§

impl Ord for IdentStr

§

fn cmp(&self, other: &IdentStr) -> Ordering

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

impl PartialEq<IdentStr> for IdentStr

§

fn eq(&self, other: &IdentStr) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialOrd<IdentStr> for IdentStr

§

fn partial_cmp(&self, other: &IdentStr) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

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

fn le(&self, other: &Rhs) -> bool

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

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl RefCast for IdentStr

§

type From = str

§

fn ref_cast(_from: &<IdentStr as RefCast>::From) -> &IdentStr

§

fn ref_cast_mut(_from: &mut <IdentStr as RefCast>::From) -> &mut IdentStr

§

impl ToOwned for IdentStr

§

type Owned = Identifier

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> Identifier

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

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

impl Eq for IdentStr

§

impl StructuralEq for IdentStr

§

impl StructuralPartialEq for IdentStr

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CallHasher for Twhere T: Hash + ?Sized,

§

fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64where H: Hash + ?Sized, B: BuildHasher,

source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more