pub struct PgEnumType { /* private fields */ }Expand description
PostgreSQL enum type metadata with ordered variants.
Implementations§
Source§impl PgEnumType
impl PgEnumType
Sourcepub const fn new(name: PgEnumName) -> Self
pub const fn new(name: PgEnumName) -> Self
Creates enum type metadata from a name.
Sourcepub fn with_schema(self, schema: PgSchemaName) -> Self
pub fn with_schema(self, schema: PgSchemaName) -> Self
Adds schema qualification.
Sourcepub fn with_variants(
self,
variants: Vec<PgEnumVariant>,
) -> Result<Self, PgEnumError>
pub fn with_variants( self, variants: Vec<PgEnumVariant>, ) -> Result<Self, PgEnumError>
Replaces the ordered variant list.
§Errors
Returns PgEnumError::DuplicateVariant when a label appears more than once.
Sourcepub fn push_variant(
&mut self,
variant: PgEnumVariant,
) -> Result<(), PgEnumError>
pub fn push_variant( &mut self, variant: PgEnumVariant, ) -> Result<(), PgEnumError>
Appends a variant while preserving order.
§Errors
Returns PgEnumError::DuplicateVariant when the label already exists.
Sourcepub const fn schema(&self) -> Option<&PgSchemaName>
pub const fn schema(&self) -> Option<&PgSchemaName>
Returns the optional schema name.
Sourcepub const fn name(&self) -> &PgEnumName
pub const fn name(&self) -> &PgEnumName
Returns the enum type name.
Sourcepub fn variants(&self) -> &[PgEnumVariant]
pub fn variants(&self) -> &[PgEnumVariant]
Returns ordered variants.
Trait Implementations§
Source§impl Clone for PgEnumType
impl Clone for PgEnumType
Source§fn clone(&self) -> PgEnumType
fn clone(&self) -> PgEnumType
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 PgEnumType
impl Debug for PgEnumType
Source§impl Display for PgEnumType
impl Display for PgEnumType
Source§impl Hash for PgEnumType
impl Hash for PgEnumType
Source§impl Ord for PgEnumType
impl Ord for PgEnumType
Source§fn cmp(&self, other: &PgEnumType) -> Ordering
fn cmp(&self, other: &PgEnumType) -> Ordering
1.21.0 (const: unstable) · 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 for PgEnumType
impl PartialEq for PgEnumType
Source§fn eq(&self, other: &PgEnumType) -> bool
fn eq(&self, other: &PgEnumType) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for PgEnumType
impl PartialOrd for PgEnumType
impl Eq for PgEnumType
impl StructuralPartialEq for PgEnumType
Auto Trait Implementations§
impl Freeze for PgEnumType
impl RefUnwindSafe for PgEnumType
impl Send for PgEnumType
impl Sync for PgEnumType
impl Unpin for PgEnumType
impl UnsafeUnpin for PgEnumType
impl UnwindSafe for PgEnumType
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