pub struct Ident {
pub(crate) value: String,
pub(crate) quote_style: Option<char>,
}Expand description
An identifier, decomposed into its value or character data and the quote style.
Fields§
§value: StringThe value of the identifier without quotes.
quote_style: Option<char>The starting quote if any. Valid quote characters are the single quote, double quote, backtick, and opening square bracket.
Implementations§
Source§impl Ident
impl Ident
Sourcepub fn new_unchecked<S>(value: S) -> Self
pub fn new_unchecked<S>(value: S) -> Self
Create a new identifier with the given value and no quotes. the given value must not be a empty string.
Sourcepub fn with_quote_unchecked<S>(quote: char, value: S) -> Self
pub fn with_quote_unchecked<S>(quote: char, value: S) -> Self
Create a new quoted identifier with the given quote and value. the given value must not be a empty string and the given quote must be in [‘'’, ‘“’, ‘`’, ‘[’].
Sourcepub fn with_quote_check<S>(quote: char, value: S) -> Result<Ident, ParserError>
pub fn with_quote_check<S>(quote: char, value: S) -> Result<Ident, ParserError>
Create a new quoted identifier with the given quote and value. returns ParserError when the given string is empty or the given quote is illegal.
Sourcepub fn real_value(&self) -> String
pub fn real_value(&self) -> String
Value after considering quote style In certain places, double quotes can force case-sensitive, but not always e.g. session variables.
Sourcepub fn from_real_value(value: &str) -> Self
pub fn from_real_value(value: &str) -> Self
Convert a real value back to Ident. Behaves the same as SQL function quote_ident or
QuoteIdent wrapper in common crate.
pub fn quote_style(&self) -> Option<char>
Trait Implementations§
impl Eq for Ident
impl StructuralPartialEq for Ident
Auto Trait Implementations§
impl Freeze for Ident
impl RefUnwindSafe for Ident
impl Send for Ident
impl Sync for Ident
impl Unpin for Ident
impl UnwindSafe for Ident
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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