serde_path_serializer 1.0.0

A Serde serializer for Path
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 5.89 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.2 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • phoenix741

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>,
}