Skip to content

Commit

Permalink
UniqueRc: platform-specific AsFd/Handle/etc impls to mirror Rc
Browse files Browse the repository at this point in the history
  • Loading branch information
zachs18 authored and gitbot committed Feb 20, 2025
1 parent d754b41 commit adf32f0
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@
#![feature(thin_box)]
#![feature(try_reserve_kind)]
#![feature(try_with_capacity)]
#![feature(unique_rc_arc)]
#![feature(vec_into_raw_parts)]
// tidy-alphabetical-end
//
Expand Down
8 changes: 8 additions & 0 deletions std/src/os/fd/owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,14 @@ impl<T: AsFd + ?Sized> AsFd for crate::rc::Rc<T> {
}
}

#[unstable(feature = "unique_rc_arc", issue = "112566")]
impl<T: AsFd + ?Sized> AsFd for crate::rc::UniqueRc<T> {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
(**self).as_fd()
}
}

#[stable(feature = "asfd_ptrs", since = "1.64.0")]
impl<T: AsFd + ?Sized> AsFd for Box<T> {
#[inline]
Expand Down
8 changes: 8 additions & 0 deletions std/src/os/fd/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,14 @@ impl<T: AsRawFd> AsRawFd for crate::rc::Rc<T> {
}
}

#[unstable(feature = "unique_rc_arc", issue = "112566")]
impl<T: AsRawFd + ?Sized> AsRawFd for crate::rc::UniqueRc<T> {
#[inline]
fn as_raw_fd(&self) -> RawFd {
(**self).as_raw_fd()
}
}

#[stable(feature = "asrawfd_ptrs", since = "1.63.0")]
impl<T: AsRawFd> AsRawFd for Box<T> {
#[inline]
Expand Down
8 changes: 8 additions & 0 deletions std/src/os/windows/io/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,14 @@ impl<T: AsHandle + ?Sized> AsHandle for crate::rc::Rc<T> {
}
}

#[unstable(feature = "unique_rc_arc", issue = "112566")]
impl<T: AsHandle + ?Sized> AsHandle for crate::rc::UniqueRc<T> {
#[inline]
fn as_handle(&self) -> BorrowedHandle<'_> {
(**self).as_handle()
}
}

#[stable(feature = "as_windows_ptrs", since = "1.71.0")]
impl<T: AsHandle + ?Sized> AsHandle for Box<T> {
#[inline]
Expand Down
8 changes: 8 additions & 0 deletions std/src/os/windows/io/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,14 @@ impl<T: AsSocket> AsSocket for crate::rc::Rc<T> {
}
}

#[unstable(feature = "unique_rc_arc", issue = "112566")]
impl<T: AsSocket + ?Sized> AsSocket for crate::rc::UniqueRc<T> {
#[inline]
fn as_socket(&self) -> BorrowedSocket<'_> {
(**self).as_socket()
}
}

#[stable(feature = "as_windows_ptrs", since = "1.71.0")]
impl<T: AsSocket> AsSocket for Box<T> {
#[inline]
Expand Down

0 comments on commit adf32f0

Please sign in to comment.