Skip to main content

text_to_enum

Function text_to_enum 

Source
pub fn text_to_enum<T: DeserializeOwned>(
    column: &'static str,
    value: &str,
) -> DbResult<T>
Expand description

Decodes a value read from column back into a fieldless, serde-tagged enum.

Only fails if value doesn’t match any of T’s variants — which the migration’s CHECK constraint on every enum-shaped column should make unreachable in practice, but the database file is plain and open (see AGENTS.md), so nothing stops something else from writing a row that bypasses it.