♻️🍱 config, cli, vanth, vanth_derive, varo: Reformatted code and added editor configuration files
- Added `.zed/settings.json` to configure rust-analyzer with `leptosfmt`. - Created `rustfmt.toml` with max width 120 and comment wrapping settings. - Applied consistent formatting across all modified crates using rustfmt. - Reorganized import statements and improved code style in multiple modules.
This commit is contained in:
parent
87957bfbf8
commit
9e7979931c
15 changed files with 141 additions and 161 deletions
|
@ -1,7 +1,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use vanth::{hash, store::Store, Vanth};
|
||||
use std::path::PathBuf;
|
||||
use tempfile::TempDir;
|
||||
use vanth::{Vanth, hash, store::Store};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Vanth)]
|
||||
struct Foo {
|
||||
|
@ -18,28 +18,28 @@ fn test_sqlite_store() {
|
|||
let dir = TempDir::new().unwrap();
|
||||
let path = dir.path().join("test.db");
|
||||
let mut store = Store::from_path(path.clone()).unwrap();
|
||||
|
||||
|
||||
let foo_1 = Foo { inner: 1 };
|
||||
let foo_2 = Foo { inner: 2 };
|
||||
let bar_1 = Bar { inner: "hello".into() };
|
||||
|
||||
|
||||
assert_eq!(store.get_all_of_type::<Foo>().unwrap().len(), 0);
|
||||
assert_eq!(store.get_all_of_type::<Bar>().unwrap().len(), 0);
|
||||
|
||||
|
||||
store.write(&foo_1).unwrap();
|
||||
store.write(&foo_2).unwrap();
|
||||
store.write(&bar_1).unwrap();
|
||||
assert_eq!(store.get_all_of_type::<Foo>().unwrap().len(), 2);
|
||||
assert_eq!(store.get_all_of_type::<Bar>().unwrap().len(), 1);
|
||||
|
||||
|
||||
let foo_2_hash = hash(&foo_2);
|
||||
let foo_2_fetched = store.get_from_hash(foo_2_hash).unwrap().unwrap();
|
||||
assert_ne!(foo_1, foo_2_fetched);
|
||||
assert_eq!(foo_2, foo_2_fetched);
|
||||
|
||||
|
||||
store.delete::<Foo>(foo_2_hash).unwrap();
|
||||
assert_eq!(store.get_all_of_type::<Foo>().unwrap().len(), 1);
|
||||
|
||||
|
||||
store.delete_all::<Foo>().unwrap();
|
||||
store.delete_all::<Bar>().unwrap();
|
||||
assert_eq!(store.get_all_of_type::<Foo>().unwrap().len(), 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue