mirror of
https://github.com/async-rs/async-std.git
synced 2025-03-27 03:30:25 +00:00
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",
|
"mio-uds",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
|
"serde-remotes",
|
||||||
]
|
]
|
||||||
docs = ["attributes", "unstable"]
|
docs = ["attributes", "unstable"]
|
||||||
unstable = ["default", "broadcaster"]
|
unstable = ["default", "broadcaster"]
|
||||||
attributes = ["async-attributes"]
|
attributes = ["async-attributes"]
|
||||||
|
serde-support = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
std = [
|
std = [
|
||||||
"async-macros",
|
"async-macros",
|
||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
|
@ -70,6 +74,7 @@ once_cell = { version = "1.2.0", optional = true }
|
||||||
pin-project-lite = { version = "0.1", optional = true }
|
pin-project-lite = { version = "0.1", optional = true }
|
||||||
pin-utils = { version = "0.1.0-alpha.4", optional = true }
|
pin-utils = { version = "0.1.0-alpha.4", optional = true }
|
||||||
slab = { version = "0.4.2", optional = true }
|
slab = { version = "0.4.2", optional = true }
|
||||||
|
serde = { version = "1.0.0", optional = true, features = ["derive"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
femme = "1.2.0"
|
femme = "1.2.0"
|
||||||
|
|
|
@ -13,12 +13,16 @@ use crate::path::Path;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
#[cfg(feature = "unstable")]
|
#[cfg(feature = "unstable")]
|
||||||
use crate::stream::{self, FromStream, IntoStream};
|
use crate::stream::{self, FromStream, IntoStream};
|
||||||
|
#[cfg(feature = "serde-support")]
|
||||||
|
use serde::{Serialize, Deserialize};
|
||||||
|
|
||||||
/// This struct is an async version of [`std::path::PathBuf`].
|
/// This struct is an async version of [`std::path::PathBuf`].
|
||||||
///
|
///
|
||||||
/// [`std::path::Path`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html
|
/// [`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)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct PathBuf {
|
pub struct PathBuf {
|
||||||
|
#[cfg_attr(feature = "serde-support", serde(flatten))]
|
||||||
inner: std::path::PathBuf,
|
inner: std::path::PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue