[−][src]Module librojo::path_serializer
path_serializer is used in cases where we need to serialize relative Path and PathBuf objects in a way that's cross-platform.
This is used for the snapshot testing system to make sure that snapshots that reference local paths that are generated on Windows don't fail when run in systems that use a different directory separator.
To use, annotate your PathBuf or Option
#[derive(Serialize, Deserialize)] struct Mine { name: String, // Use 'crate' instead of librojo if writing code inside Rojo #[serde(serialize_with = "librojo::path_serializer::serialize")] source_path: PathBuf, #[serde(serialize_with = "librojo::path_serializer::serialize_option")] maybe_path: Option<PathBuf>, }
The methods in this module can only handle relative paths, since absolute paths are never portable.
Functions
serialize | |
serialize_option |