Crates.io | sedes |
lib.rs | sedes |
version | 0.9.0 |
created_at | 2025-02-16 17:56:07.272524+00 |
updated_at | 2025-04-12 04:40:38.575278+00 |
description | SErialization & DEserialization Simplified |
homepage | |
repository | https://github.com/Siiir/sedes |
max_upload_size | |
id | 1557997 |
size | 67,428 |
An open-source Rust library, which focuses on doing serialization and deserialization with {dynamic, deduced} serialization format.
Currently, supported deserialization formats - JSON
, YAML
, CBOR
, RMP
, Bincode
, Pickle
.
Currently, supported serialization formats - Compact JSON
, Pretty JSON
, YAML
, CBOR
, RMP
, Bincode
, Pickle
.
Behold the deduction of (de)serialization format from file extension.
Write JSON to a file, then deserialize.
let path = std::env::temp_dir().join("example.json");
std::fs::write(&path, "[1, 2, 42]").unwrap();
let deserialized: Vec<i32> = sedes::deserialize_from_file(&path).unwrap();
assert_eq!(deserialized, vec![1, 2, 42]);
Write to a temporary yaml file, then assert content.
let path = std::env::temp_dir().join("example.yml");
sedes::serialize_to_file( &path, "W", &[1, 2, 42] ).unwrap();
let serialized = std::fs::read_to_string(&path).unwrap();
assert_eq!(serialized, "- 1\n- 2\n- 42\n");
cargo
including fmt
subcommandThis project uses GitHub Actions for continuous integration. The CI pipeline includes:
cargo test --all-targets
)cargo rustdoc
)cargo fmt
cargo fmt --check
This project uses a custom rustfmt configuration to enforce consistent code formatting. Below are the key formatting rules we are following:
Setting | Value | Description |
---|---|---|
max_width |
100 |
Maximum width of a line before breaking |
hard_tabs |
false |
Use spaces instead of tabs |
tab_spaces |
4 |
Number of spaces per indentation level |
newline_style |
"Auto" |
Use system-native line endings (LF/CRLF) |
use_small_heuristics |
"Default" |
Enables formatting heuristics for small constructs |
fn_call_width |
60 |
Max width for function calls on a single line |
attr_fn_like_width |
70 |
Max width for attribute-like function macros |
struct_lit_width |
18 |
Max width for struct literals |
struct_variant_width |
35 |
Max width for struct variants in enums |
array_width |
60 |
Max width for arrays on a single line |
chain_width |
60 |
Max width for method chains on a single line |
single_line_if_else_max_width |
50 |
Max width for single-line if/else expressions |
single_line_let_else_max_width |
50 |
Max width for single-line let...else expressions |
reorder_imports |
true |
Automatically sort use statements |
reorder_modules |
true |
Automatically sort module declarations |
fn_params_layout |
"Tall" |
Format function params vertically (one per line) |
edition |
2024 |
Rust edition for parsing and formatting |
style_edition |
2024 |
Edition used for formatting style rules |
Formatting is checked in CI using:
cargo fmt --check
Run cargo fmt
before push to automatically format your code.
The CI workflow will fail if your code does not follow the formatting rules.
If the workflow fails, the branch will be reset to state before this commit using git reset --hard HEAD~1
How to work after this on the local environment?
git pull --rebase
git clone
the repositorygit checkout -b <branch-name>
)git add .; git commit -m <msg>
)cargo test
)cargo fmt
)git commit -m 'Add some amazing feature'
)git push origin <branch-name>
)When working on issues, follow these guidelines: