Skip to main content

DatabaseSerde

Trait DatabaseSerde 

Source
pub trait DatabaseSerde {
    // Required methods
    fn insert_struct<T: Serialize>(
        &self,
        table: &str,
        key: &[u8],
        data: &T,
    ) -> DbxResult<()>;
    fn get_struct<T: DeserializeOwned>(
        &self,
        table: &str,
        key: &[u8],
    ) -> DbxResult<Option<T>>;
}
Expand description

serde 기반의 구조체 직접 입출력을 지원하는 Trait

Required Methods§

Source

fn insert_struct<T: Serialize>( &self, table: &str, key: &[u8], data: &T, ) -> DbxResult<()>

구조체를 직렬화하여 삽입

Source

fn get_struct<T: DeserializeOwned>( &self, table: &str, key: &[u8], ) -> DbxResult<Option<T>>

데이터를 조회하여 구조체로 역직렬화

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§