mirror of
https://github.com/async-rs/async-std.git
synced 2025-04-25 09:46:49 +00:00
Use crate::path everywhere
This commit is contained in:
parent
f9cfee9e2c
commit
504f8cb137
22 changed files with 39 additions and 42 deletions
|
@ -1,6 +1,5 @@
|
|||
use std::path::Path;
|
||||
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// Copies the contents and permissions of a file to a new location.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::path::Path;
|
||||
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// Creates a new directory.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::path::Path;
|
||||
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// Creates a new directory and all of its parents if they are missing.
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use std::path::Path;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
|
||||
use crate::future::Future;
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// A builder for creating directories with configurable options.
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use std::ffi::OsString;
|
||||
use std::fmt;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
|
||||
use crate::fs::{FileType, Metadata};
|
||||
use crate::io;
|
||||
use crate::path::PathBuf;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// An entry in a directory.
|
||||
|
@ -50,7 +50,7 @@ impl DirEntry {
|
|||
/// # Ok(()) }) }
|
||||
/// ```
|
||||
pub fn path(&self) -> PathBuf {
|
||||
self.0.path()
|
||||
self.0.path().into()
|
||||
}
|
||||
|
||||
/// Reads the metadata for this entry.
|
||||
|
|
|
@ -3,7 +3,6 @@ use std::cmp;
|
|||
use std::fmt;
|
||||
use std::io::{Read as _, Seek as _, Write as _};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::path::Path;
|
||||
use std::pin::Pin;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
@ -13,6 +12,7 @@ use cfg_if::cfg_if;
|
|||
use crate::fs::{Metadata, Permissions};
|
||||
use crate::future;
|
||||
use crate::io::{self, Read, Seek, SeekFrom, Write};
|
||||
use crate::path::Path;
|
||||
use crate::prelude::*;
|
||||
use crate::task::{self, blocking, Context, Poll, Waker};
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::path::Path;
|
||||
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// Creates a hard link on the filesystem.
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
use std::path::Path;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
|
||||
use crate::fs::File;
|
||||
use crate::future::Future;
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// A builder for opening files with configurable options.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::path::Path;
|
||||
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// Reads the entire contents of a file as raw bytes.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::path::Path;
|
||||
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// Reads the entire contents of a file as a string.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::path::Path;
|
||||
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// Removes an empty directory.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::path::Path;
|
||||
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// Removes a directory and all of its contents.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::path::Path;
|
||||
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// Removes a file.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::path::Path;
|
||||
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// Renames a file or directory to a new location.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use std::path::Path;
|
||||
|
||||
use crate::fs::Permissions;
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// Changes the permissions of a file or directory.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::path::Path;
|
||||
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// Writes a slice of bytes as the new contents of a file.
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
//! Unix-specific filesystem extensions.
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
|
||||
use crate::io;
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// Creates a new symbolic link on the filesystem.
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
use std::fmt;
|
||||
use std::net::Shutdown;
|
||||
use std::path::Path;
|
||||
|
||||
use mio_uds;
|
||||
|
||||
|
@ -11,6 +10,7 @@ use crate::future;
|
|||
use crate::io;
|
||||
use crate::net::driver::Watcher;
|
||||
use crate::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
|
||||
use crate::path::Path;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// A Unix datagram socket.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
//! Unix-specific networking extensions.
|
||||
|
||||
use std::fmt;
|
||||
use std::path::Path;
|
||||
use std::pin::Pin;
|
||||
|
||||
use mio_uds;
|
||||
|
@ -12,6 +11,7 @@ use crate::future::{self, Future};
|
|||
use crate::io;
|
||||
use crate::net::driver::Watcher;
|
||||
use crate::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
|
||||
use crate::path::Path;
|
||||
use crate::stream::Stream;
|
||||
use crate::task::{blocking, Context, Poll};
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@ mod stream;
|
|||
cfg_if! {
|
||||
if #[cfg(feature = "docs")] {
|
||||
use std::fmt;
|
||||
use std::path::Path;
|
||||
|
||||
use crate::path::Path;
|
||||
|
||||
/// An address associated with a Unix socket.
|
||||
///
|
||||
|
@ -65,9 +66,8 @@ cfg_if! {
|
|||
/// With a pathname:
|
||||
///
|
||||
/// ```no_run
|
||||
/// use std::path::Path;
|
||||
///
|
||||
/// use async_std::os::unix::net::UnixListener;
|
||||
/// use async_std::path::Path;
|
||||
///
|
||||
/// let socket = UnixListener::bind("/tmp/socket").await?;
|
||||
/// let addr = socket.local_addr()?;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use std::fmt;
|
||||
use std::io::{Read as _, Write as _};
|
||||
use std::net::Shutdown;
|
||||
use std::path::Path;
|
||||
use std::pin::Pin;
|
||||
|
||||
use mio_uds;
|
||||
|
@ -12,6 +11,7 @@ use super::SocketAddr;
|
|||
use crate::io::{self, Read, Write};
|
||||
use crate::net::driver::Watcher;
|
||||
use crate::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
|
||||
use crate::path::Path;
|
||||
use crate::task::{blocking, Context, Poll};
|
||||
|
||||
/// A Unix stream socket.
|
||||
|
|
|
@ -801,9 +801,15 @@ impl<'a> Into<&'a std::path::Path> for &'a Path {
|
|||
}
|
||||
}
|
||||
|
||||
impl AsRef<OsStr> for Path {
|
||||
fn as_ref(&self) -> &OsStr {
|
||||
self.inner.as_ref()
|
||||
impl AsRef<std::path::Path> for Path {
|
||||
fn as_ref(&self) -> &std::path::Path {
|
||||
self.into()
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<Path> for std::path::Path {
|
||||
fn as_ref(&self) -> &Path {
|
||||
self.into()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -813,6 +819,12 @@ impl AsRef<Path> for Path {
|
|||
}
|
||||
}
|
||||
|
||||
impl AsRef<OsStr> for Path {
|
||||
fn as_ref(&self) -> &OsStr {
|
||||
self.inner.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<Path> for OsStr {
|
||||
fn as_ref(&self) -> &Path {
|
||||
Path::new(self)
|
||||
|
|
Loading…
Reference in a new issue