1 stable release
1.0.0 | Aug 14, 2024 |
---|
#769 in Encoding
53 downloads per month
4KB
Serde Path Serializer
This crate provides a Path
serializer for Serde.
Usage
Add this to your Cargo.toml
:
cargo add serde_path_serializer
[dependencies]
serde_path_serializer = "0.1"
Example
use serde_path_serializer::serialize_path;
let path = std::path::Path::new("foo/bar/baz");
let serialized = serialize_path(&path);
assert_eq!(serialized, "foo/bar/baz");
or
use serde_path_serializer::serialize_path;
use serde::Serialize;
#[derive(Serialize)]
struct MyStruct {
#[serde(serialize_with = "serialize_path")]
data: Vec<u8>,
}
Dependencies
~110–340KB