forked from mirror/async-std
Add proof of concept serde support with PathBuf
This commit is contained in:
parent
54371c21c1
commit
4e88f104c5
2 changed files with 9 additions and 0 deletions
|
@ -33,10 +33,14 @@ default = [
|
|||
"mio-uds",
|
||||
"num_cpus",
|
||||
"pin-project-lite",
|
||||
"serde-remotes",
|
||||
]
|
||||
docs = ["attributes", "unstable"]
|
||||
unstable = ["default", "broadcaster"]
|
||||
attributes = ["async-attributes"]
|
||||
serde-support = [
|
||||
"serde",
|
||||
]
|
||||
std = [
|
||||
"async-macros",
|
||||
"crossbeam-utils",
|
||||
|
@ -70,6 +74,7 @@ once_cell = { version = "1.2.0", optional = true }
|
|||
pin-project-lite = { version = "0.1", optional = true }
|
||||
pin-utils = { version = "0.1.0-alpha.4", optional = true }
|
||||
slab = { version = "0.4.2", optional = true }
|
||||
serde = { version = "1.0.0", optional = true, features = ["derive"] }
|
||||
|
||||
[dev-dependencies]
|
||||
femme = "1.2.0"
|
||||
|
|
|
@ -13,12 +13,16 @@ use crate::path::Path;
|
|||
use crate::prelude::*;
|
||||
#[cfg(feature = "unstable")]
|
||||
use crate::stream::{self, FromStream, IntoStream};
|
||||
#[cfg(feature = "serde-support")]
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
/// This struct is an async version of [`std::path::PathBuf`].
|
||||
///
|
||||
/// [`std::path::Path`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html
|
||||
#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct PathBuf {
|
||||
#[cfg_attr(feature = "serde-support", serde(flatten))]
|
||||
inner: std::path::PathBuf,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue