Skip to main content

Iden

Trait Iden 

Source
pub trait Iden {
    // Required method
    fn unquoted(&self) -> &str;

    // Provided methods
    fn quoted(&self) -> Cow<'static, str> { ... }
    fn to_string(&self) -> String { ... }
}
Expand description

Identifier

Required Methods§

Source

fn unquoted(&self) -> &str

Write a raw identifier string without quotes.

We intentionally don’t reuse Display for this, because we want to allow it to have a different logic.

Provided Methods§

Source

fn quoted(&self) -> Cow<'static, str>

Return the to-be sanitized version of the identifier.

For example, for MySQL “hello” would have to be escaped as “hel``lo”. Note that this method doesn’t do the actual escape, as it’s backend specific. It only indicates whether the identifier needs to be escaped.

If the identifier doesn’t need to be escaped, return 'static str. This can be deduced at compile-time by the Iden macro, or using the is_static_iden function.

Cow::Owned would always be escaped.

Source

fn to_string(&self) -> String

A shortcut for writing an unquoted identifier into a String.

We can’t reuse ToString for this, because ToString uses the Display representation. But Iden representation is distinct from Display and can be different.

Implementations on Foreign Types§

Source§

impl Iden for &'static str

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl Iden for Identity

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn to_string(&self) -> String

Source§

fn unquoted(&self) -> &str

Source§

impl Iden for SelectA

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl Iden for SelectB

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl Iden for SelectC

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for BoolColumn<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for BytesColumn<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for DateLikeColumn<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for DateTimeLikeColumn<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for GenericArrayColumn<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for IpNetworkColumn<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for JsonColumn<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for NumericArrayColumn<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for NumericColumn<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for NumericColumnNullable<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for StringColumn<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for StringColumnNullable<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for TextUuidColumn<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for TimeLikeColumn<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Source§

impl<E> Iden for UuidColumn<E>
where E: EntityTrait,

Source§

fn quoted(&self) -> Cow<'static, str>

Source§

fn unquoted(&self) -> &str

Implementors§