@@ -399,12 +399,6 @@ impl FromRawFd for OwnedFd {
399
399
400
400
#[ cfg( windows) ]
401
401
impl FromRawHandle for OwnedHandle {
402
- /// Constructs a new instance of `Self` from the given raw handle.
403
- ///
404
- /// # Safety
405
- ///
406
- /// The resource pointed to by `raw` must be open and suitable for assuming
407
- /// ownership.
408
402
#[ inline]
409
403
unsafe fn from_raw_handle ( handle : RawHandle ) -> Self {
410
404
Self { handle }
@@ -413,12 +407,6 @@ impl FromRawHandle for OwnedHandle {
413
407
414
408
#[ cfg( windows) ]
415
409
impl FromRawSocket for OwnedSocket {
416
- /// Constructs a new instance of `Self` from the given raw socket.
417
- ///
418
- /// # Safety
419
- ///
420
- /// The resource pointed to by `raw` must be open and suitable for assuming
421
- /// ownership.
422
410
#[ inline]
423
411
unsafe fn from_raw_socket ( socket : RawSocket ) -> Self {
424
412
debug_assert_ne ! ( socket, INVALID_SOCKET as RawSocket ) ;
@@ -427,7 +415,7 @@ impl FromRawSocket for OwnedSocket {
427
415
}
428
416
429
417
#[ cfg( windows) ]
430
- impl FromRawHandle for HandleOrInvalid {
418
+ impl HandleOrInvalid {
431
419
/// Constructs a new instance of `Self` from the given `RawHandle` returned
432
420
/// from a Windows API that uses `INVALID_HANDLE_VALUE` to indicate
433
421
/// failure, such as `CreateFileW`.
@@ -437,20 +425,20 @@ impl FromRawHandle for HandleOrInvalid {
437
425
///
438
426
/// # Safety
439
427
///
440
- /// The resource pointed to by `handle` must be either open and otherwise
441
- /// unowned, null , or equal to `INVALID_HANDLE_VALUE` (-1). Note that not
442
- /// all Windows APIs use `INVALID_HANDLE_VALUE` for errors; see [here] for
443
- /// the full story.
428
+ /// The passed `handle` value must either satisfy the safety requirements
429
+ /// of [`FromRawHandle::from_raw_handle`] , or be
430
+ /// `INVALID_HANDLE_VALUE` (-1). Note that not all Windows APIs use
431
+ /// `INVALID_HANDLE_VALUE` for errors; see [here] for the full story.
444
432
///
445
433
/// [here]: https://devblogs.microsoft.com/oldnewthing/20040302-00/?p=40443
446
434
#[ inline]
447
- unsafe fn from_raw_handle ( handle : RawHandle ) -> Self {
435
+ pub unsafe fn from_raw_handle ( handle : RawHandle ) -> Self {
448
436
Self ( handle)
449
437
}
450
438
}
451
439
452
440
#[ cfg( windows) ]
453
- impl FromRawHandle for HandleOrNull {
441
+ impl HandleOrNull {
454
442
/// Constructs a new instance of `Self` from the given `RawHandle` returned
455
443
/// from a Windows API that uses null to indicate failure, such as
456
444
/// `CreateThread`.
@@ -460,13 +448,13 @@ impl FromRawHandle for HandleOrNull {
460
448
///
461
449
/// # Safety
462
450
///
463
- /// The resource pointed to by `handle` must be either open and otherwise
464
- /// unowned , or null. Note that not all Windows APIs use null for errors;
465
- /// see [here] for the full story.
451
+ /// The passed `handle` value must either satisfy the safety requirements
452
+ /// of [`FromRawHandle::from_raw_handle`] , or be null. Note that not all
453
+ /// Windows APIs use null for errors; see [here] for the full story.
466
454
///
467
455
/// [here]: https://devblogs.microsoft.com/oldnewthing/20040302-00/?p=40443
468
456
#[ inline]
469
- unsafe fn from_raw_handle ( handle : RawHandle ) -> Self {
457
+ pub unsafe fn from_raw_handle ( handle : RawHandle ) -> Self {
470
458
Self ( handle)
471
459
}
472
460
}
0 commit comments