#[repr(transparent)]
pub struct IdentStr(_);
Expand description

A borrowed identifier.

For more details, see the module level documentation.

Implementations§

source§

impl IdentStr

source

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

source

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

Returns true if this string is a valid identifier.

source

pub fn len(&self) -> usize

Returns the length of self in bytes.

source

pub fn is_empty(&self) -> bool

Returns true if self has a length of zero bytes.

source

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.

source

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

Converts self to a byte slice.

Trait Implementations§

source§

impl AsRef<IdentStr> for Identifier

source§

fn as_ref(&self) -> &IdentStr

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

impl Borrow<IdentStr> for Identifier

source§

fn borrow(&self) -> &IdentStr

Immutably borrows from an owned value. Read more
source§

impl Debug for IdentStr

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for IdentStr

source§

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

Formats the value using the given formatter. Read more
source§

impl From<&IdentStr> for Identifier

source§

fn from(ident_str: &IdentStr) -> Self

Converts to this type from the input type.
source§

impl Hash for IdentStr

source§

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

Feeds this value into the given Hasher. Read more
source§

impl Ord for IdentStr

source§

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

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

impl PartialEq<IdentStr> for IdentStr

source§

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.
source§

impl PartialOrd<IdentStr> for IdentStr

source§

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
source§

impl RefCast for IdentStr

§

type From = str

source§

fn ref_cast(_from: &Self::From) -> &Self

source§

fn ref_cast_mut(_from: &mut Self::From) -> &mut Self

source§

impl ToOwned for IdentStr

§

type Owned = Identifier

The resulting type after obtaining ownership.
source§

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
source§

impl Eq for IdentStr

source§

impl StructuralEq for IdentStr

source§

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
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