pub struct SharedFD(/* private fields */);Expand description
Implements Clone trait that creates new SharedFD with Arc::clone of the
embedded handle.
Each clone()/dup() of SharedFD contains the same handle.
§Example
use pakr_managedrawfd::*;
use std::os::unix::io::AsRawFd;
let stdout_handle = std::io::stdout().lock().as_raw_fd();
// We don't want myShH to close the real stdout, therefore dup_wrap;
let myShH = SharedFD::dup_wrap(stdout_handle).unwrap();
// ... myShH shall have handle other than stdout.
assert_ne!(myShH.as_raw_fd(),stdout_handle);
// Clone it
let myOtherShH = myShH.clone();
// ... myOtherShH shall have the same handle as myShH.
assert_eq!(myOtherShH.as_raw_fd(),myShH.as_raw_fd());
Trait Implementations§
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more