Crate timeout_io[][src]

About

This library provides a simple timeout-based API for IO-operations.

It provides the following features:

  • DNS-resolution (currently uses a background-thread)
  • TCP-accept (uses libselect)
  • TCP-read/read-until/write (uses libselect)
  • StdIOE-read/read-write/write (uses libselect)
  • UDP-receive/send (uses libselect)

All functions are defined as traits, so that you can easily wrap your own IO-channels without breaking compatibility.

Note: We currently do not provide a function for timeout-based connect-calls; use std::net::TcpStream::connect_timeout for TCP-connections or build sth. using io::libselect (and feel free to commit if you do so 😇)

Modules

libselect

Interface to libselect

Structs

IoError

An IO-error-wrapper

SliceQueue

Enums

Event

An event returned by libselect's wait_for_event

IoErrorKind

A list specifying general categories of I/O error.

Traits

Acceptor

A trait for accepting elements, e.g. a TCP-listener

DnsResolvable

A trait for elements which contain a DNS-resolvable address

DurationExt

Extends std::time::Duration

InstantExt

Extends std::time::Instant

IpParseable

A trait for elements which can be parsed to an IP-address

RawFd

A wrapper-trait that unifies the std::os::unix::io::AsRawFd and std::os::windows::io::AsRawSocket traits

ReadableSliceQueue
Reader

A trait for reading with timeouts

WaitForEvent

This trait defines an API to wait for an event

WriteableSliceQueue
Writer

A trait for writing with timeouts

Type Definitions

Result

Syntactic sugar for std::result::Result<T, etrace::Error<IoError>>