Skip to content

Commit 3ec732d

Browse files
committed
Added From<Box<Path>> for Socket<'a>
Signed-off-by: Jiahao XU <[email protected]>
1 parent e082d95 commit 3ec732d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/changelog.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use crate::*;
88
/// - `From<Cow<'a, Path>> for Socket<'a>`
99
/// - `From<&'a Path> for Socket<'a>`
1010
/// - `From<PathBuf> for Socket<'a>`
11+
/// - `From<Box<Path>> for Socket<'a>`
1112
///
1213
/// ## Changed
1314
/// - [`Session::request_port_forward`] now takes `impl Into<...>`

src/port_forwarding.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ impl From<PathBuf> for Socket<'static> {
7474
}
7575
}
7676

77+
impl From<Box<Path>> for Socket<'static> {
78+
fn from(path: Box<Path>) -> Self {
79+
Socket::UnixSocket {
80+
path: Cow::Owned(path.into()),
81+
}
82+
}
83+
}
84+
7785
impl Socket<'_> {
7886
/// Create a new TcpSocket
7987
pub fn new<T: ToSocketAddrs>(addr: &T) -> Result<Socket<'static>, io::Error> {

0 commit comments

Comments
 (0)