1 stable release

1.0.0 Aug 14, 2024

#769 in Encoding

Download history 113/week @ 2024-08-10 12/week @ 2024-08-17 14/week @ 2024-09-14 15/week @ 2024-09-21 25/week @ 2024-09-28 7/week @ 2024-10-05 5/week @ 2024-10-12

53 downloads per month

MIT license

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