pub struct Enum {
pub schema: Cow<'static, str>,
pub name: Cow<'static, str>,
pub values: Cow<'static, [Cow<'static, str>]>,
}Expand description
Runtime enum entity for serde serialization.
Uses Cow<'static, str> for all string fields, which works with both:
- Borrowed data from const definitions (
Cow::Borrowed) - Owned data from deserialization/introspection (
Cow::Owned)
Fields§
§schema: Cow<'static, str>Schema name
name: Cow<'static, str>Enum name
values: Cow<'static, [Cow<'static, str>]>Enum values
Implementations§
Source§impl Enum
impl Enum
Sourcepub fn new(
schema: impl Into<Cow<'static, str>>,
name: impl Into<Cow<'static, str>>,
values: impl Into<Cow<'static, [Cow<'static, str>]>>,
) -> Self
pub fn new( schema: impl Into<Cow<'static, str>>, name: impl Into<Cow<'static, str>>, values: impl Into<Cow<'static, [Cow<'static, str>]>>, ) -> Self
Create a new enum (runtime)
Source§impl Enum
impl Enum
Sourcepub fn create_enum_sql(&self) -> String
pub fn create_enum_sql(&self) -> String
Generate CREATE TYPE … AS ENUM SQL
Sourcepub fn drop_enum_sql(&self) -> String
pub fn drop_enum_sql(&self) -> String
Generate DROP TYPE SQL
Trait Implementations§
impl Eq for Enum
impl StructuralPartialEq for Enum
Auto Trait Implementations§
impl Freeze for Enum
impl RefUnwindSafe for Enum
impl Send for Enum
impl Sync for Enum
impl Unpin for Enum
impl UnwindSafe for Enum
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