Struct compio_runtime::Attacher
source · pub struct Attacher { /* private fields */ }
Expand description
Attach a handle to the driver of current thread.
A handle can and only can attach once to one driver. However, the handle itself is Send & Sync. We mark it !Send & !Sync to warn users, making them ensure that they are using it in the correct thread.
Implementations§
source§impl Attacher
impl Attacher
sourcepub fn attach(&self, source: &impl AsRawFd) -> Result<()>
pub fn attach(&self, source: &impl AsRawFd) -> Result<()>
Attach the source. This method could be called many times, but if the action fails, the error will only return once.
You should always call this method before accessing the runtime. It ensures that the current runtime is the exact runtime attached before.
sourcepub fn is_attached(&self) -> bool
pub fn is_attached(&self) -> bool
Check if [attach
] has been called.
sourcepub fn try_clone(&self, source: &impl AsRawFd) -> Result<Self>
pub fn try_clone(&self, source: &impl AsRawFd) -> Result<Self>
Try clone self with the cloned source. The attach state will be reserved.
Platform specific
- io-uring/polling: it will try to attach in the current thread if needed.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Attacher
impl !Send for Attacher
impl !Sync for Attacher
impl Unpin for Attacher
impl UnwindSafe for Attacher
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