Struct datamodel_renderer::datamodel::Enum
source · pub struct Enum<'a> { /* private fields */ }
Expand description
An enum block in a PSL file.
Implementations§
source§impl<'a> Enum<'a>
impl<'a> Enum<'a>
sourcepub fn new(name: impl Into<Cow<'a, str>>) -> Self
pub fn new(name: impl Into<Cow<'a, str>>) -> Self
Create a new enum declaration block. Will not be valid without adding at least one variant.
ⓘ
enum TrafficLight {
// ^^^^^^^^^^^^ name
}
sourcepub fn documentation(&mut self, documentation: impl Into<Cow<'a, str>>)
pub fn documentation(&mut self, documentation: impl Into<Cow<'a, str>>)
The documentation on top of the enum declaration.
ⓘ
/// This here is the documentation.
enum Foo {
Bar
}
sourcepub fn schema(&mut self, schema: impl Into<Cow<'a, str>>)
pub fn schema(&mut self, schema: impl Into<Cow<'a, str>>)
The schema attribute of the enum block
ⓘ
enum Foo {
Bar
@@schema("public")
^^^^^^ this
}
sourcepub fn push_variant(&mut self, variant: impl Into<EnumVariant<'a>>)
pub fn push_variant(&mut self, variant: impl Into<EnumVariant<'a>>)
Add a new variant to the enum declaration. If passing a string
slice, adds a simple enum variant. Additionally an
EnumVariant
can be constructed and passed for additional
settings.
ⓘ
enum Foo {
Bar
^^^ this
}
Trait Implementations§
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Enum<'a>
impl<'a> Send for Enum<'a>
impl<'a> Sync for Enum<'a>
impl<'a> Unpin for Enum<'a>
impl<'a> UnwindSafe for Enum<'a>
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
Mutably borrows from an owned value. Read more