serde_path_serializer

Crates.ioserde_path_serializer
lib.rsserde_path_serializer
version1.0.0
sourcesrc
created_at2024-08-14 11:25:40.110277
updated_at2024-08-14 11:25:40.110277
descriptionA Serde serializer for Path
homepagehttps://gogs.shadoware.org/phoenix/serde_path_serializer
repositoryhttps://gogs.shadoware.org/phoenix/serde_path_serializer.git
max_upload_size
id1337155
size4,600
Ulrich Vandenhekke (phoenix741)

documentation

README

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>,
}
Commit count: 0

cargo fmt