Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to io-lifetimes 1.0. #273

Merged
merged 3 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ publish = false
exclude = ["/.*"]

[dev-dependencies]
async-std = { version = "1.10.0", features = ["attributes"] }
#async-std = { version = "1.10.0", features = ["attributes"] }
anyhow = "1.0.37"
cap-async-std = { path = "cap-async-std", version = "^0.25.0" }
#cap-async-std = { path = "cap-async-std", version = "^0.25.0" }
cap-fs-ext = { path = "cap-fs-ext", version = "^0.25.0" }
cap-directories = { path = "cap-directories", version = "^0.25.0" }
cap-std = { path = "cap-std", version = "^0.25.0" }
Expand All @@ -26,10 +26,10 @@ rand = "0.8.1"
tempfile = "3.1.0"
camino = "1.0.5"
libc = "0.2.100"
io-lifetimes = "0.7.0"
io-lifetimes = "1.0.0-rc1"

[target.'cfg(not(windows))'.dev-dependencies]
rustix = { version = "0.35.6", features = ["fs"] }
rustix = { version = "0.36.0-rc1", features = ["fs"] }

[target.'cfg(windows)'.dev-dependencies]
# nt_version uses internal Windows APIs, however we're only using it
Expand All @@ -51,23 +51,23 @@ fs_utf8 = [
"cap-fs-ext/fs_utf8",
"cap-tempfile/fs_utf8",
]
async_std_fs_utf8 = [
"cap-async-std/fs_utf8",
"cap-fs-ext/async_std_fs_utf8"
]
#async_std_fs_utf8 = [
# "cap-async-std/fs_utf8",
# "cap-fs-ext/async_std_fs_utf8"
#]
arf_strings = [
"cap-std/arf_strings",
"cap-fs-ext/arf_strings",
"cap-tempfile/arf_strings",
]
async_std_arf_strings = [
"cap-async-std/arf_strings",
"cap-fs-ext/async_std_arf_strings"
]
#async_std_arf_strings = [
# "cap-async-std/arf_strings",
# "cap-fs-ext/async_std_arf_strings"
#]

[workspace]
members = [
"cap-async-std",
#"cap-async-std",
"cap-fs-ext",
"cap-directories",
"cap-primitives",
Expand Down
7 changes: 4 additions & 3 deletions cap-async-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@ keywords = ["network", "file", "async", "future", "await"]
categories = ["filesystem", "network-programming", "asynchronous", "concurrency"]
repository = "https://github.com/bytecodealliance/cap-std"
edition = "2018"
publish = false # temporary, until async-rs/async-std#1036 is available

[dependencies]
arf-strings = { version = "0.6.7", optional = true }
# Enable "unstable" for `spawn_blocking`.
async-std = { version = "1.10.0", features = ["attributes", "unstable"] }
cap-primitives = { path = "../cap-primitives", version = "^0.25.0" }
io-lifetimes = { version = "0.7.0", default-features = false, features = ["async-std"] }
io-lifetimes = { version = "1.0.0-rc1", default-features = false, features = ["async-std"] }
ipnet = "2.3.0"
io-extras = { version = "0.15.0", features = ["use_async_std"] }
io-extras = { version = "0.16.0-rc1", features = ["use_async_std"] }
camino = { version = "1.0.5", optional = true }

[target.'cfg(not(windows))'.dependencies]
rustix = { version = "0.35.6", features = ["fs"] }
rustix = { version = "0.36.0-rc1", features = ["fs"] }

[features]
default = []
Expand Down
28 changes: 14 additions & 14 deletions cap-async-std/src/fs/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ use cap_primitives::fs::{
};
use cap_primitives::AmbientAuthority;
#[cfg(not(windows))]
use io_lifetimes::{AsFd, BorrowedFd, FromFd, IntoFd, OwnedFd};
use io_lifetimes::{AsFd, BorrowedFd, OwnedFd};
use io_lifetimes::{AsFilelike, FromFilelike};
#[cfg(windows)]
use io_lifetimes::{AsHandle, BorrowedHandle, FromHandle, IntoHandle, OwnedHandle};
use io_lifetimes::{AsHandle, BorrowedHandle, OwnedHandle};
use std::fmt;
#[cfg(unix)]
use {
Expand Down Expand Up @@ -869,10 +869,10 @@ impl FromRawFd for Dir {
}

#[cfg(not(windows))]
impl FromFd for Dir {
impl From<OwnedFd> for Dir {
#[inline]
fn from_fd(fd: OwnedFd) -> Self {
Self::from_std_file(fs::File::from_fd(fd))
fn from(fd: OwnedFd) -> Self {
Self::from_std_file(fs::File::from(fd))
}
}

Expand All @@ -887,10 +887,10 @@ impl FromRawHandle for Dir {
}

#[cfg(windows)]
impl FromHandle for Dir {
impl From<OwnedHandle> for Dir {
#[inline]
fn from_handle(handle: OwnedHandle) -> Self {
Self::from_std_file(fs::File::from_handle(handle))
fn from(handle: OwnedHandle) -> Self {
Self::from_std_file(fs::File::from(handle))
}
}

Expand Down Expand Up @@ -943,10 +943,10 @@ impl IntoRawFd for Dir {
}

#[cfg(not(windows))]
impl IntoFd for Dir {
impl From<Dir> for OwnedFd {
#[inline]
fn into_fd(self) -> OwnedFd {
self.std_file.into_fd()
fn from(dir: Dir) -> OwnedFd {
dir.std_file.into()
}
}

Expand All @@ -959,10 +959,10 @@ impl IntoRawHandle for Dir {
}

#[cfg(windows)]
impl IntoHandle for Dir {
impl From<Dir> for OwnedHandle {
#[inline]
fn into_handle(self) -> OwnedHandle {
self.std_file.into_handle()
fn from(dir: Dir) -> OwnedHandle {
dir.std_file.into()
}
}

Expand Down
28 changes: 14 additions & 14 deletions cap-async-std/src/fs/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use cap_primitives::fs::{is_file_read_write, open_ambient};
use cap_primitives::AmbientAuthority;
use io_lifetimes::AsFilelike;
#[cfg(not(windows))]
use io_lifetimes::{AsFd, BorrowedFd, FromFd, IntoFd, OwnedFd};
use io_lifetimes::{AsFd, BorrowedFd, OwnedFd};
#[cfg(windows)]
use io_lifetimes::{AsHandle, BorrowedHandle, FromHandle, IntoHandle, OwnedHandle};
use io_lifetimes::{AsHandle, BorrowedHandle, OwnedHandle};
use std::fmt;
use std::path::Path;
use std::pin::Pin;
Expand Down Expand Up @@ -197,10 +197,10 @@ impl FromRawFd for File {
}

#[cfg(not(windows))]
impl FromFd for File {
impl From<OwnedFd> for File {
#[inline]
fn from_fd(fd: OwnedFd) -> Self {
Self::from_std(fs::File::from_fd(fd))
fn from(fd: OwnedFd) -> Self {
Self::from_std(fs::File::from(fd))
}
}

Expand All @@ -213,10 +213,10 @@ impl FromRawHandle for File {
}

#[cfg(windows)]
impl FromHandle for File {
impl From<OwnedHandle> for File {
#[inline]
fn from_handle(handle: OwnedHandle) -> Self {
Self::from_std(fs::File::from_handle(handle))
fn from(handle: OwnedHandle) -> Self {
Self::from_std(fs::File::from(handle))
}
}

Expand Down Expand Up @@ -269,10 +269,10 @@ impl IntoRawFd for File {
}

#[cfg(not(windows))]
impl IntoFd for File {
impl From<File> for OwnedFd {
#[inline]
fn into_fd(self) -> OwnedFd {
self.std.into_fd()
fn from(file: File) -> OwnedFd {
file.std.into()
}
}

Expand All @@ -285,10 +285,10 @@ impl IntoRawHandle for File {
}

#[cfg(windows)]
impl IntoHandle for File {
impl From<File> for OwnedHandle {
#[inline]
fn into_handle(self) -> OwnedHandle {
self.std.into_handle()
fn from(file: File) -> OwnedHandle {
file.std.into()
}
}

Expand Down
26 changes: 13 additions & 13 deletions cap-async-std/src/fs_utf8/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use cap_primitives::AmbientAuthority;
#[cfg(not(windows))]
use io_lifetimes::{AsFd, BorrowedFd, FromFd, IntoFd, OwnedFd};
#[cfg(windows)]
use io_lifetimes::{AsHandle, BorrowedHandle, FromHandle, IntoHandle, OwnedHandle};
use io_lifetimes::{AsHandle, BorrowedHandle, OwnedHandle};
use std::fmt;
#[cfg(unix)]
use {
Expand Down Expand Up @@ -644,10 +644,10 @@ impl FromRawFd for Dir {
}

#[cfg(not(windows))]
impl FromFd for Dir {
impl From<OwnedFd> for Dir {
#[inline]
fn from_fd(fd: OwnedFd) -> Self {
Self::from_std_file(fs::File::from_fd(fd))
fn from(fd: OwnedFd) -> Self {
Self::from_std_file(fs::File::from(fd))
}
}

Expand All @@ -662,10 +662,10 @@ impl FromRawHandle for Dir {
}

#[cfg(windows)]
impl FromHandle for Dir {
impl From<OwnedHandle> for Dir {
#[inline]
fn from_handle(handle: OwnedHandle) -> Self {
Self::from_std_file(fs::File::from_handle(handle))
fn from(handle: OwnedHandle) -> Self {
Self::from_std_file(fs::File::from(handle))
}
}

Expand Down Expand Up @@ -718,10 +718,10 @@ impl IntoRawFd for Dir {
}

#[cfg(not(windows))]
impl IntoFd for Dir {
impl From<Dir> for OwnedFd {
#[inline]
fn into_fd(self) -> OwnedFd {
self.cap_std.into_fd()
fn from(dir: Dir) -> OwnedFd {
dir.cap_std.into()
}
}

Expand All @@ -734,10 +734,10 @@ impl IntoRawHandle for Dir {
}

#[cfg(windows)]
impl IntoHandle for Dir {
impl From<Dir> for OwnedHandle {
#[inline]
fn into_handle(self) -> OwnedHandle {
self.cap_std.into_handle()
fn from(dir: Dir) -> OwnedHandle {
dir.cap_std.into()
}
}

Expand Down
26 changes: 13 additions & 13 deletions cap-async-std/src/fs_utf8/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use cap_primitives::AmbientAuthority;
#[cfg(not(windows))]
use io_lifetimes::{AsFd, BorrowedFd, FromFd, IntoFd, OwnedFd};
#[cfg(windows)]
use io_lifetimes::{AsHandle, BorrowedHandle, FromHandle, IntoHandle, OwnedHandle};
use io_lifetimes::{AsHandle, BorrowedHandle, OwnedHandle};
use std::fmt;
use std::pin::Pin;
#[cfg(windows)]
Expand Down Expand Up @@ -160,10 +160,10 @@ impl FromRawFd for File {
}

#[cfg(not(windows))]
impl FromFd for File {
impl From<OwnedFd> for File {
#[inline]
fn from_fd(fd: OwnedFd) -> Self {
Self::from_std(fs::File::from_fd(fd))
fn from(fd: OwnedFd) -> Self {
Self::from_std(fs::File::from(fd))
}
}

Expand All @@ -176,10 +176,10 @@ impl FromRawHandle for File {
}

#[cfg(windows)]
impl FromHandle for File {
impl From<OwnedHandle> for File {
#[inline]
fn from_handle(handle: OwnedHandle) -> Self {
Self::from_std(fs::File::from_handle(handle))
fn from(handle: OwnedHandle) -> Self {
Self::from_std(fs::File::from(handle))
}
}

Expand Down Expand Up @@ -232,10 +232,10 @@ impl IntoRawFd for File {
}

#[cfg(not(windows))]
impl IntoFd for File {
impl From<File> for OwnedFd {
#[inline]
fn into_fd(self) -> OwnedFd {
self.cap_std.into_fd()
fn from(file: File) -> OwnedFd {
file.cap_std.into()
}
}

Expand All @@ -248,10 +248,10 @@ impl IntoRawHandle for File {
}

#[cfg(windows)]
impl IntoHandle for File {
impl From<File> for OwnedHandle {
#[inline]
fn into_handle(self) -> OwnedHandle {
self.cap_std.into_handle()
fn from(file: File) -> OwnedHandle {
file.cap_std.into()
}
}

Expand Down
Loading