pub enum Identifier {
Quoted(String),
Unquoted(String),
}
Expand description
Identifers are either Quoted or Unquoted.
- Unquoted Identifiers: are case insensitive
- Quoted Identifiers: are case sensitive. double quotes appearing within the quoted string are escaped by doubling (i.e.
"foo""bar" is interpreted as
foo“bar`)
Quoted lower lower case is equivalent to unquoted mixed case. Quoted( myid ) == Unquoted( myid ) Quoted( myid ) == Unquoted( “myId” ) Quoted( myid ) != Quoted( “myId” )
It is possible to create an Unquoted identifier with an embedded quote (e.g. Identifier::Unquoted( "foo\"bar" )
).
Note that a quote as the first character in an Unquoted Identifier can cause problems if the Identifier is converted
to a string and then parsed again as the second parse will create a Quoted identifier.
Variants§
Quoted(String)
This variant is case sensitive “fOo”“bAr”“” is stored as fOo“bAr“
Unquoted(String)
This variant is case insensitive Only ascii alphanumeric and _ characters are allowed in this variant fOo_bAr is stored as fOo_bAr
Implementations§
Source§impl Identifier
impl Identifier
Sourcepub fn parse(text: &str) -> Identifier
pub fn parse(text: &str) -> Identifier
parses strings as returned by the parser into Quoted or Unquoted Identifiers.
- Unquoted Identifiers: are case insensitive
- Quoted Identifiers: are case sensitive. double quotes appearing within the quoted string
are escaped by doubling (i.e.
"foo""bar" is interpreted as
foo“bar`)
If the string starts with "
it is assumed to be a quoted identifier, the leading and trailing quotes are removed
and the internal doubled quotes (""
) are converted to simple quotes ("
).
Trait Implementations§
Source§impl Clone for Identifier
impl Clone for Identifier
Source§fn clone(&self) -> Identifier
fn clone(&self) -> Identifier
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Identifier
impl Debug for Identifier
Source§impl Default for Identifier
impl Default for Identifier
Source§impl<'de> Deserialize<'de> for Identifier
impl<'de> Deserialize<'de> for Identifier
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for Identifier
impl Display for Identifier
Source§impl From<&String> for Identifier
impl From<&String> for Identifier
Source§impl From<&str> for Identifier
impl From<&str> for Identifier
Source§impl Hash for Identifier
impl Hash for Identifier
Source§impl Ord for Identifier
impl Ord for Identifier
Source§fn cmp(&self, other: &Identifier) -> Ordering
fn cmp(&self, other: &Identifier) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq<Identifier> for IdentifierRef<'_>
impl PartialEq<Identifier> for IdentifierRef<'_>
Source§impl PartialEq<IdentifierRef<'_>> for Identifier
impl PartialEq<IdentifierRef<'_>> for Identifier
Source§impl PartialEq for Identifier
impl PartialEq for Identifier
Source§impl PartialOrd for Identifier
impl PartialOrd for Identifier
impl Eq for Identifier
Auto Trait Implementations§
impl Freeze for Identifier
impl RefUnwindSafe for Identifier
impl Send for Identifier
impl Sync for Identifier
impl Unpin for Identifier
impl UnwindSafe for Identifier
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more