@@ -597,12 +597,6 @@ impl FromRawFd for OwnedFd {
597
597
598
598
#[ cfg( windows) ]
599
599
impl FromRawHandle for OwnedHandle {
600
- /// Constructs a new instance of `Self` from the given raw handle.
601
- ///
602
- /// # Safety
603
- ///
604
- /// The resource pointed to by `raw` must be open and suitable for assuming
605
- /// ownership.
606
600
#[ inline]
607
601
unsafe fn from_raw_handle ( handle : RawHandle ) -> Self {
608
602
Self { handle }
@@ -611,12 +605,6 @@ impl FromRawHandle for OwnedHandle {
611
605
612
606
#[ cfg( windows) ]
613
607
impl FromRawSocket for OwnedSocket {
614
- /// Constructs a new instance of `Self` from the given raw socket.
615
- ///
616
- /// # Safety
617
- ///
618
- /// The resource pointed to by `raw` must be open and suitable for assuming
619
- /// ownership.
620
608
#[ inline]
621
609
unsafe fn from_raw_socket ( socket : RawSocket ) -> Self {
622
610
debug_assert_ne ! ( socket, INVALID_SOCKET as RawSocket ) ;
@@ -625,7 +613,7 @@ impl FromRawSocket for OwnedSocket {
625
613
}
626
614
627
615
#[ cfg( windows) ]
628
- impl FromRawHandle for HandleOrInvalid {
616
+ impl HandleOrInvalid {
629
617
/// Constructs a new instance of `Self` from the given `RawHandle` returned
630
618
/// from a Windows API that uses `INVALID_HANDLE_VALUE` to indicate
631
619
/// failure, such as `CreateFileW`.
@@ -635,20 +623,20 @@ impl FromRawHandle for HandleOrInvalid {
635
623
///
636
624
/// # Safety
637
625
///
638
- /// The resource pointed to by `handle` must be either open and otherwise
639
- /// unowned, null , or equal to `INVALID_HANDLE_VALUE` (-1). Note that not
640
- /// all Windows APIs use `INVALID_HANDLE_VALUE` for errors; see [here] for
641
- /// the full story.
626
+ /// The passed `handle` value must either satisfy the safety requirements
627
+ /// of [`FromRawHandle::from_raw_handle`] , or be
628
+ /// `INVALID_HANDLE_VALUE` (-1). Note that not all Windows APIs use
629
+ /// `INVALID_HANDLE_VALUE` for errors; see [here] for the full story.
642
630
///
643
631
/// [here]: https://devblogs.microsoft.com/oldnewthing/20040302-00/?p=40443
644
632
#[ inline]
645
- unsafe fn from_raw_handle ( handle : RawHandle ) -> Self {
633
+ pub unsafe fn from_raw_handle ( handle : RawHandle ) -> Self {
646
634
Self ( handle)
647
635
}
648
636
}
649
637
650
638
#[ cfg( windows) ]
651
- impl FromRawHandle for HandleOrNull {
639
+ impl HandleOrNull {
652
640
/// Constructs a new instance of `Self` from the given `RawHandle` returned
653
641
/// from a Windows API that uses null to indicate failure, such as
654
642
/// `CreateThread`.
@@ -658,13 +646,13 @@ impl FromRawHandle for HandleOrNull {
658
646
///
659
647
/// # Safety
660
648
///
661
- /// The resource pointed to by `handle` must be either open and otherwise
662
- /// unowned , or null. Note that not all Windows APIs use null for errors;
663
- /// see [here] for the full story.
649
+ /// The passed `handle` value must either satisfy the safety requirements
650
+ /// of [`FromRawHandle::from_raw_handle`] , or be null. Note that not all
651
+ /// Windows APIs use null for errors; see [here] for the full story.
664
652
///
665
653
/// [here]: https://devblogs.microsoft.com/oldnewthing/20040302-00/?p=40443
666
654
#[ inline]
667
- unsafe fn from_raw_handle ( handle : RawHandle ) -> Self {
655
+ pub unsafe fn from_raw_handle ( handle : RawHandle ) -> Self {
668
656
Self ( handle)
669
657
}
670
658
}
0 commit comments