[][src]Trait libuv::handles::handle::HandleTrait

pub trait HandleTrait: ToHandle {
    fn is_active(&self) -> bool { ... }
fn is_closing(&self) -> bool { ... }
fn close<CB: Into<CloseCB<'static>>>(&mut self, cb: CB) { ... }
fn ref(&mut self) { ... }
fn unref(&mut self) { ... }
fn has_ref(&self) -> bool { ... }
fn send_buffer_size(&mut self, value: i32) -> Result<i32> { ... }
fn recv_buffer_size(&mut self, value: i32) -> Result<i32> { ... }
fn get_fileno(&self) -> Result<OsFile> { ... }
fn get_loop(&self) -> Loop { ... }
fn get_type(&self) -> HandleType { ... } }

Provided methods

fn is_active(&self) -> bool

Returns non-zero if the handle is active, zero if it’s inactive. What “active” means depends on the type of handle:

  • An AsyncHandle is always active and cannot be deactivated, except by closing it with close().
  • A PipeHandle, TcpHandle, UdpHandle, etc. - basically any handle that deals with i/o - is active when it is doing something that involves i/o, like reading, writing, connecting, accepting new connections, etc.
  • A CheckHandle, IdleHandle, TimerHandle, etc. is active when it has been started with a call to start().

Rule of thumb: if a handle start() function, then it’s active from the moment that function is called. Likewise, stop() deactivates the handle again.

fn is_closing(&self) -> bool

Returns non-zero if the handle is closing or closed, zero otherwise.

Note: This function should only be used between the initialization of the handle and the arrival of the close callback.

fn close<CB: Into<CloseCB<'static>>>(&mut self, cb: CB)

Request handle to be closed. close_cb will be called asynchronously after this call. This MUST be called on each handle before memory is released. Moreover, the memory can only be released in close_cb or after it has returned.

Handles that wrap file descriptors are closed immediately but close_cb will still be deferred to the next iteration of the event loop. It gives you a chance to free up any resources associated with the handle.

In-progress requests, like ConnectRequest or WriteRequest, are cancelled and have their callbacks called asynchronously with status=UV_ECANCELED.

fn ref(&mut self)

Reference the given handle. References are idempotent, that is, if a handle is already referenced calling this function again will have no effect.

fn unref(&mut self)

Un-reference the given handle. References are idempotent, that is, if a handle is not referenced calling this function again will have no effect.

fn has_ref(&self) -> bool

Returns true if the handle referenced, zero otherwise.

fn send_buffer_size(&mut self, value: i32) -> Result<i32>

Gets or sets the size of the send buffer that the operating system uses for the socket.

If value == 0, then it will return the current send buffer size. If value > 0 then it will use value to set the new send buffer size and return that.

This function works for TCP, pipe and UDP handles on Unix and for TCP and UDP handles on Windows.

Note: Linux will set double the size and return double the size of the original set value.

fn recv_buffer_size(&mut self, value: i32) -> Result<i32>

Gets or sets the size of the receive buffer that the operating system uses for the socket.

If value == 0, then it will return the current receive buffer size. If value > 0 then it will use value to set the new receive buffer size and return that.

This function works for TCP, pipe and UDP handles on Unix and for TCP and UDP handles on Windows.

Note: Linux will set double the size and return double the size of the original set value.

fn get_fileno(&self) -> Result<OsFile>

Gets the platform dependent file descriptor equivalent.

The following handles are supported: TCP, pipes, TTY, UDP and poll. Passing any other handle type will fail with EINVAL.

If a handle doesn’t have an attached file descriptor yet or the handle itself has been closed, this function will return EBADF.

Warning: Be very careful when using this function. libuv assumes it’s in control of the file descriptor so any change to it may lead to malfunction.

fn get_loop(&self) -> Loop

Returns the Loop associated with this handle.

fn get_type(&self) -> HandleType

Returns the type of the handle.

Loading content...

Implementors

impl HandleTrait for AsyncHandle[src]

impl HandleTrait for CheckHandle[src]

impl HandleTrait for FsEventHandle[src]

impl HandleTrait for FsPollHandle[src]

impl HandleTrait for Handle[src]

impl HandleTrait for IdleHandle[src]

impl HandleTrait for PollHandle[src]

impl HandleTrait for PrepareHandle[src]

impl HandleTrait for ProcessHandle[src]

impl HandleTrait for SignalHandle[src]

impl HandleTrait for PipeHandle[src]

impl HandleTrait for StreamHandle[src]

impl HandleTrait for TcpHandle[src]

impl HandleTrait for TtyHandle[src]

impl HandleTrait for UdpHandle[src]

impl HandleTrait for TimerHandle[src]

Loading content...