pub enum TemplateField {
SchemeName,
SchemeAuthor,
SchemeSlug,
ColorField(ColorField),
UnparsableField,
}
Expand description
type representing a field in the mustache template
see https://github.com/chriskempson/base16/blob/main/builder.md#template-tags
Examples
use base16_color_scheme::template::{
color_field::{ColorField, Format, Hex},
TemplateField,
};
assert_eq!(
TemplateField::parse_field("scheme-name"),
TemplateField::SchemeName
);
assert_eq!(
TemplateField::parse_field("scheme-author"),
TemplateField::SchemeAuthor
);
assert_eq!(
TemplateField::parse_field("scheme-slug"),
TemplateField::SchemeSlug
);
assert_eq!(
TemplateField::parse_field("base07-hex-r"),
TemplateField::ColorField(ColorField {
number: 0x07,
format: Format::Hex(Hex::R)
})
)
Variants§
SchemeName
this variant is returned for scheme-name
and scheme
SchemeAuthor
this variant is returned for scheme-author
SchemeSlug
this variant is returned for scheme-slug
ColorField(ColorField)
this variant is returned for a color description
see ColorField
and Format
for details
UnparsableField
this variant is returned if the parsed string is invalid
Implementations§
source§impl TemplateField
impl TemplateField
pub fn parse_field(name: &str) -> Self
Trait Implementations§
source§impl Clone for TemplateField
impl Clone for TemplateField
source§fn clone(&self) -> TemplateField
fn clone(&self) -> TemplateField
Returns a copy 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 Debug for TemplateField
impl Debug for TemplateField
source§impl<'de> Deserialize<'de> for TemplateField
impl<'de> Deserialize<'de> for TemplateField
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Hash for TemplateField
impl Hash for TemplateField
source§impl Ord for TemplateField
impl Ord for TemplateField
source§fn cmp(&self, other: &TemplateField) -> Ordering
fn cmp(&self, other: &TemplateField) -> 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 PartialEq<TemplateField> for TemplateField
impl PartialEq<TemplateField> for TemplateField
source§fn eq(&self, other: &TemplateField) -> bool
fn eq(&self, other: &TemplateField) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<TemplateField> for TemplateField
impl PartialOrd<TemplateField> for TemplateField
source§fn partial_cmp(&self, other: &TemplateField) -> Option<Ordering>
fn partial_cmp(&self, other: &TemplateField) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more