pub unsafe trait Sqlite3Serialize: Sqlite3Api {
// Required methods
unsafe fn serialize(
&self,
db: NonNull<Self::Db>,
schema: Option<&str>,
flags: u32,
) -> Result<OwnedBytes>;
unsafe fn deserialize(
&self,
db: NonNull<Self::Db>,
schema: Option<&str>,
data: &[u8],
flags: u32,
) -> Result<()>;
unsafe fn free(&self, bytes: OwnedBytes);
}Expand description
Optional backend extension for serialize/deserialize.
§Safety
Implementations must pair serialize allocations with free, and
deserialize must not retain references to caller-owned data.
Required Methods§
Sourceunsafe fn serialize(
&self,
db: NonNull<Self::Db>,
schema: Option<&str>,
flags: u32,
) -> Result<OwnedBytes>
unsafe fn serialize( &self, db: NonNull<Self::Db>, schema: Option<&str>, flags: u32, ) -> Result<OwnedBytes>
Serialize a schema database into backend-owned bytes.
Sourceunsafe fn deserialize(
&self,
db: NonNull<Self::Db>,
schema: Option<&str>,
data: &[u8],
flags: u32,
) -> Result<()>
unsafe fn deserialize( &self, db: NonNull<Self::Db>, schema: Option<&str>, data: &[u8], flags: u32, ) -> Result<()>
Replace schema contents from caller-owned bytes.
Sourceunsafe fn free(&self, bytes: OwnedBytes)
unsafe fn free(&self, bytes: OwnedBytes)
Free serialized bytes previously returned by serialize.
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.