pub enum RustIdentifier<'a> {
Identifier(&'a str),
NonIdentifier(&'a str),
KeywordRawSafe(&'a str),
KeywordUnderscorePostfix(&'a str),
}Expand description
Categorizes a rust identifier for use in rust codegen.
Variants§
Identifier(&'a str)
Meets the criteria for a Rust NON_KEYWORD_IDENTIFIER
NonIdentifier(&'a str)
Not a rust-safe identifier. Unicode, strange ASCII values, relatively normal ASCII values… you name it.
KeywordRawSafe(&'a str)
A keyword that has had r# prepended to it, because it can
be used as a RAW_IDENTIFIER
KeywordUnderscorePostfix(&'a str)
A keyword that has had _ postpended to it, because it can
not be used as a RAW_IDENTIFIER.
Implementations§
Source§impl<'a> RustIdentifier<'a>
impl<'a> RustIdentifier<'a>
Sourcepub fn from_str(s: &'a str) -> RustIdentifier<'a>
pub fn from_str(s: &'a str) -> RustIdentifier<'a>
Takes an arbitrary string and tries to treat it as a Rust identifier, doing minor escaping for keywords.
Trait Implementations§
Source§impl<'a> Clone for RustIdentifier<'a>
impl<'a> Clone for RustIdentifier<'a>
Source§fn clone(&self) -> RustIdentifier<'a>
fn clone(&self) -> RustIdentifier<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for RustIdentifier<'a>
impl<'a> Debug for RustIdentifier<'a>
Source§impl<'a> Hash for RustIdentifier<'a>
impl<'a> Hash for RustIdentifier<'a>
Source§impl<'a> Ord for RustIdentifier<'a>
impl<'a> Ord for RustIdentifier<'a>
Source§fn cmp(&self, other: &RustIdentifier<'a>) -> Ordering
fn cmp(&self, other: &RustIdentifier<'a>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a> PartialEq for RustIdentifier<'a>
impl<'a> PartialEq for RustIdentifier<'a>
Source§impl<'a> PartialOrd for RustIdentifier<'a>
impl<'a> PartialOrd for RustIdentifier<'a>
impl<'a> Copy for RustIdentifier<'a>
impl<'a> Eq for RustIdentifier<'a>
impl<'a> StructuralPartialEq for RustIdentifier<'a>
Auto Trait Implementations§
impl<'a> Freeze for RustIdentifier<'a>
impl<'a> RefUnwindSafe for RustIdentifier<'a>
impl<'a> Send for RustIdentifier<'a>
impl<'a> Sync for RustIdentifier<'a>
impl<'a> Unpin for RustIdentifier<'a>
impl<'a> UnwindSafe for RustIdentifier<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more