Switch DB layer to Diesel from SeaORM and Fjall #2
3 changed files with 5 additions and 17 deletions
5
rustfmt.toml
Normal file
5
rustfmt.toml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
imports_granularity = "Module"
|
||||||
|
group_imports = "StdExternalCrate"
|
||||||
|
wrap_comments = true
|
||||||
|
use_small_heuristics = "Max"
|
||||||
|
edition = "2021"
|
|
@ -8,7 +8,6 @@ pub mod permissions;
|
||||||
pub mod prelude;
|
pub mod prelude;
|
||||||
pub mod provider;
|
pub mod provider;
|
||||||
pub mod schema;
|
pub mod schema;
|
||||||
pub mod serialize;
|
|
||||||
pub mod server;
|
pub mod server;
|
||||||
pub mod session;
|
pub mod session;
|
||||||
pub mod templates;
|
pub mod templates;
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
use bincode::{DefaultOptions, Options};
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
fn bincode_options() -> impl Options {
|
|
||||||
DefaultOptions::new().with_big_endian()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn serialize<T: ?Sized + Serialize>(value: &T) -> Result<Vec<u8>, bincode::Error> {
|
|
||||||
let options = bincode_options();
|
|
||||||
options.serialize(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn deserialize<'a, T: Deserialize<'a>>(bytes: &'a [u8]) -> Result<T, bincode::Error> {
|
|
||||||
let options = bincode_options();
|
|
||||||
options.deserialize(bytes)
|
|
||||||
}
|
|
Loading…
Reference in a new issue