Skip to main content

ReqTrait

Trait ReqTrait 

Source
pub trait ReqTrait: ToReq {
    // Provided methods
    fn cancel(&mut self) -> Result<()> { ... }
    fn get_type(&self) -> ReqType { ... }
}

Provided Methods§

Source

fn cancel(&mut self) -> Result<()>

Cancel a pending request. Fails if the request is executing or has finished executing.

Only cancellation of FsReq, GetAddrInfoReq, GetNameInfoReq, RandomReq and WorkReq requests is currently supported.

Cancelled requests have their callbacks invoked some time in the future. It’s not safe to free the memory associated with the request until the callback is called.

Here is how cancellation is reported to the callback:

  • A FsReq request has its req->result field set to UV_ECANCELED.
  • A WorkReq, GetAddrInfoReq, GetNameInfoReq or RandomReq request has its callback invoked with status == UV_ECANCELED.
Source

fn get_type(&self) -> ReqType

Returns the type of the request.

Implementors§