pub trait PostgresEnum: Sized {
const PG_TYPE_NAME: &'static str;
// Required methods
fn to_label(&self) -> &'static str;
fn from_label(label: &str) -> Result<Self, Box<dyn Error + Sync + Send>>;
}Expand description
Trait implemented by Rust enums that map to PostgreSQL enum types.
Can be implemented manually or via the #[derive(PostgresEnum)] macro.
Required Associated Constants§
Sourceconst PG_TYPE_NAME: &'static str
const PG_TYPE_NAME: &'static str
The PostgreSQL type name (e.g., “mood”). Schema-qualify if needed (e.g., “public.mood”).
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".