Use crate::path everywhere

yoshuawuyts-patch-1
Stjepan Glavina 5 years ago
parent f9cfee9e2c
commit 504f8cb137

@ -1,6 +1,5 @@
use std::path::Path;
use crate::io; use crate::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// Copies the contents and permissions of a file to a new location. /// 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::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// Creates a new directory. /// Creates a new directory.

@ -1,6 +1,5 @@
use std::path::Path;
use crate::io; use crate::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// Creates a new directory and all of its parents if they are missing. /// 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 cfg_if::cfg_if;
use crate::future::Future; use crate::future::Future;
use crate::io; use crate::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// A builder for creating directories with configurable options. /// A builder for creating directories with configurable options.

@ -1,12 +1,12 @@
use std::ffi::OsString; use std::ffi::OsString;
use std::fmt; use std::fmt;
use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use cfg_if::cfg_if; use cfg_if::cfg_if;
use crate::fs::{FileType, Metadata}; use crate::fs::{FileType, Metadata};
use crate::io; use crate::io;
use crate::path::PathBuf;
use crate::task::blocking; use crate::task::blocking;
/// An entry in a directory. /// An entry in a directory.
@ -50,7 +50,7 @@ impl DirEntry {
/// # Ok(()) }) } /// # Ok(()) }) }
/// ``` /// ```
pub fn path(&self) -> PathBuf { pub fn path(&self) -> PathBuf {
self.0.path() self.0.path().into()
} }
/// Reads the metadata for this entry. /// Reads the metadata for this entry.

@ -3,7 +3,6 @@ use std::cmp;
use std::fmt; use std::fmt;
use std::io::{Read as _, Seek as _, Write as _}; use std::io::{Read as _, Seek as _, Write as _};
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use std::path::Path;
use std::pin::Pin; use std::pin::Pin;
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
@ -13,6 +12,7 @@ use cfg_if::cfg_if;
use crate::fs::{Metadata, Permissions}; use crate::fs::{Metadata, Permissions};
use crate::future; use crate::future;
use crate::io::{self, Read, Seek, SeekFrom, Write}; use crate::io::{self, Read, Seek, SeekFrom, Write};
use crate::path::Path;
use crate::prelude::*; use crate::prelude::*;
use crate::task::{self, blocking, Context, Poll, Waker}; use crate::task::{self, blocking, Context, Poll, Waker};

@ -1,6 +1,5 @@
use std::path::Path;
use crate::io; use crate::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// Creates a hard link on the filesystem. /// Creates a hard link on the filesystem.

@ -1,10 +1,9 @@
use std::path::Path;
use cfg_if::cfg_if; use cfg_if::cfg_if;
use crate::fs::File; use crate::fs::File;
use crate::future::Future; use crate::future::Future;
use crate::io; use crate::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// A builder for opening files with configurable options. /// A builder for opening files with configurable options.

@ -1,6 +1,5 @@
use std::path::Path;
use crate::io; use crate::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// Reads the entire contents of a file as raw bytes. /// Reads the entire contents of a file as raw bytes.

@ -1,6 +1,5 @@
use std::path::Path;
use crate::io; use crate::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// Reads the entire contents of a file as a string. /// Reads the entire contents of a file as a string.

@ -1,6 +1,5 @@
use std::path::Path;
use crate::io; use crate::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// Removes an empty directory. /// Removes an empty directory.

@ -1,6 +1,5 @@
use std::path::Path;
use crate::io; use crate::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// Removes a directory and all of its contents. /// Removes a directory and all of its contents.

@ -1,6 +1,5 @@
use std::path::Path;
use crate::io; use crate::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// Removes a file. /// Removes a file.

@ -1,6 +1,5 @@
use std::path::Path;
use crate::io; use crate::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// Renames a file or directory to a new location. /// Renames a file or directory to a new location.

@ -1,7 +1,6 @@
use std::path::Path;
use crate::fs::Permissions; use crate::fs::Permissions;
use crate::io; use crate::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// Changes the permissions of a file or directory. /// Changes the permissions of a file or directory.

@ -1,6 +1,5 @@
use std::path::Path;
use crate::io; use crate::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// Writes a slice of bytes as the new contents of a file. /// Writes a slice of bytes as the new contents of a file.

@ -1,10 +1,9 @@
//! Unix-specific filesystem extensions. //! Unix-specific filesystem extensions.
use std::path::Path;
use cfg_if::cfg_if; use cfg_if::cfg_if;
use crate::io; use crate::io;
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// Creates a new symbolic link on the filesystem. /// Creates a new symbolic link on the filesystem.

@ -2,7 +2,6 @@
use std::fmt; use std::fmt;
use std::net::Shutdown; use std::net::Shutdown;
use std::path::Path;
use mio_uds; use mio_uds;
@ -11,6 +10,7 @@ use crate::future;
use crate::io; use crate::io;
use crate::net::driver::Watcher; use crate::net::driver::Watcher;
use crate::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; use crate::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
use crate::path::Path;
use crate::task::blocking; use crate::task::blocking;
/// A Unix datagram socket. /// A Unix datagram socket.

@ -1,7 +1,6 @@
//! Unix-specific networking extensions. //! Unix-specific networking extensions.
use std::fmt; use std::fmt;
use std::path::Path;
use std::pin::Pin; use std::pin::Pin;
use mio_uds; use mio_uds;
@ -12,6 +11,7 @@ use crate::future::{self, Future};
use crate::io; use crate::io;
use crate::net::driver::Watcher; use crate::net::driver::Watcher;
use crate::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; use crate::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
use crate::path::Path;
use crate::stream::Stream; use crate::stream::Stream;
use crate::task::{blocking, Context, Poll}; use crate::task::{blocking, Context, Poll};

@ -13,7 +13,8 @@ mod stream;
cfg_if! { cfg_if! {
if #[cfg(feature = "docs")] { if #[cfg(feature = "docs")] {
use std::fmt; use std::fmt;
use std::path::Path;
use crate::path::Path;
/// An address associated with a Unix socket. /// An address associated with a Unix socket.
/// ///
@ -65,9 +66,8 @@ cfg_if! {
/// With a pathname: /// With a pathname:
/// ///
/// ```no_run /// ```no_run
/// use std::path::Path;
///
/// use async_std::os::unix::net::UnixListener; /// use async_std::os::unix::net::UnixListener;
/// use async_std::path::Path;
/// ///
/// let socket = UnixListener::bind("/tmp/socket").await?; /// let socket = UnixListener::bind("/tmp/socket").await?;
/// let addr = socket.local_addr()?; /// let addr = socket.local_addr()?;

@ -3,7 +3,6 @@
use std::fmt; use std::fmt;
use std::io::{Read as _, Write as _}; use std::io::{Read as _, Write as _};
use std::net::Shutdown; use std::net::Shutdown;
use std::path::Path;
use std::pin::Pin; use std::pin::Pin;
use mio_uds; use mio_uds;
@ -12,6 +11,7 @@ use super::SocketAddr;
use crate::io::{self, Read, Write}; use crate::io::{self, Read, Write};
use crate::net::driver::Watcher; use crate::net::driver::Watcher;
use crate::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; use crate::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
use crate::path::Path;
use crate::task::{blocking, Context, Poll}; use crate::task::{blocking, Context, Poll};
/// A Unix stream socket. /// A Unix stream socket.

@ -801,9 +801,15 @@ impl<'a> Into<&'a std::path::Path> for &'a Path {
} }
} }
impl AsRef<OsStr> for Path { impl AsRef<std::path::Path> for Path {
fn as_ref(&self) -> &OsStr { fn as_ref(&self) -> &std::path::Path {
self.inner.as_ref() 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 { impl AsRef<Path> for OsStr {
fn as_ref(&self) -> &Path { fn as_ref(&self) -> &Path {
Path::new(self) Path::new(self)

Loading…
Cancel
Save