Struct doku::Variant [−][src]
pub struct Variant {
pub id: &'static str,
pub title: &'static str,
pub comment: Option<&'static str>,
pub serializable: bool,
pub deserializable: bool,
pub fields: Fields,
}Expand description
Defines a single enum’s variant.
For instance, given this enum:
#[derive(Serialize)] enum Subject { /// Picture of a cat #[serde(rename = "picture-of-cat")] PictureOfCat, }
… the Subject::PictureOfCat variant is defined as:
Variant { id: "picture-of-cat", title: "PictureOfCat", comment: Some("Picture of a cat"), serializable: true, deserializable: true, fields: Fields::Unit, }
When no #[serde(rename = ...)] (or similar) has been provided, id is
equal to title.
Fields
id: &'static strIdentifier of the variant; it includes #[serde(rename)] and similar
attributes, so this string is exactly what gets serialized into the
output.
title: &'static strTitle of the variant as it was written in the Rust code, excluding stuff
like #[serde(rename)].
comment: Option<&'static str>serializable: booldeserializable: boolfields: FieldsTrait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Variantimpl UnwindSafe for VariantBlanket Implementations
Mutably borrows from an owned value. Read more