Skip to main content

enum_to_text

Function enum_to_text 

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

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

Returns DbError::Serialize if T does not serialize to a bare JSON string. Every bhtune-core enum stored in the database satisfies that shape; a failure here means a new type was wired into a TEXT column without checking that assumption first, and must be reported instead of panicking while a live loop may already be in manual.