Skip to main content

enum_to_text

Function enum_to_text 

Source
pub fn enum_to_text<T: Serialize>(value: &T) -> String
Expand description

Encodes a fieldless, serde-tagged enum as the bare string SQLite stores it as.

§Panics

Panics if T’s Serialize impl doesn’t produce a bare JSON string (i.e. T isn’t a fieldless enum with #[serde(rename_all = "snake_case")] or equivalent). Every bhtune-core enum stored in the database satisfies this; a panic here means a new enum was wired into a TEXT column without checking that assumption first.