1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
//! Configurations for test cases and examples. Not intended for actual use.

pub use std::fmt::Write as FmtWrite;

#[cfg(feature = "with-json")]
pub use serde_json::json;

use crate::Iden;

/// Representation of a database table named `Character`.
///
/// A `Enum` implemented [`Iden`] used in rustdoc and test to demonstrate the library usage.
///
/// [`Iden`]: crate::types::Iden
#[derive(Debug)]
pub enum Character {
    Table,
    Id,
    Character,
    FontSize,
    SizeW,
    SizeH,
    FontId,
}

/// A shorthand for [`Character`]
pub type Char = Character;

impl Iden for Character {
    fn unquoted(&self, s: &mut dyn FmtWrite) {
        write!(
            s,
            "{}",
            match self {
                Self::Table => "character",
                Self::Id => "id",
                Self::Character => "character",
                Self::FontSize => "font_size",
                Self::SizeW => "size_w",
                Self::SizeH => "size_h",
                Self::FontId => "font_id",
            }
        )
        .unwrap();
    }
}

/// Representation of a database table named `Font`.
///
/// A `Enum` implemented [`Iden`] used in rustdoc and test to demonstrate the library usage.
///
/// [`Iden`]: crate::types::Iden
#[derive(Debug)]
pub enum Font {
    Table,
    Id,
    Name,
    Variant,
    Language,
}

impl Iden for Font {
    fn unquoted(&self, s: &mut dyn FmtWrite) {
        write!(
            s,
            "{}",
            match self {
                Self::Table => "font",
                Self::Id => "id",
                Self::Name => "name",
                Self::Variant => "variant",
                Self::Language => "language",
            }
        )
        .unwrap();
    }
}

/// Representation of a database table named `Glyph`.
///
/// A `Enum` implemented [`Iden`] used in rustdoc and test to demonstrate the library usage.
///
/// [`Iden`]: crate::types::Iden
#[derive(Debug)]
pub enum Glyph {
    Table,
    Id,
    Image,
    Aspect,
}

impl Iden for Glyph {
    fn unquoted(&self, s: &mut dyn FmtWrite) {
        write!(
            s,
            "{}",
            match self {
                Self::Table => "glyph",
                Self::Id => "id",
                Self::Image => "image",
                Self::Aspect => "aspect",
            }
        )
        .unwrap();
    }
}