Crate timeout_io

Source
Expand description

§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
  • TCP-read/read-until/write
  • StdIOE-read/read-until/write
  • UDP-receive/send

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 😇)

Structs§

EventMask
A struct describing null or more IO-events
SelectSet
A set of multiple (handle: event)-pairs that allows you to call select on all pairs at the same time

Enums§

TimeoutIoError
An IO-error-wrapper

Traits§

Acceptor
A trait for accepting elements, e.g. a TCP-listener
DnsResolvable
A trait for elements which contain a DNS-resolvable address
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
Reader
A trait for reading with timeouts
WaitForEvent
This trait defines an API to wait for an event
Writer
A trait for writing with timeouts