Crate rust_tcp_ipc

source ·
Expand description

This is a crate for Interprocess Communication via TCP.

It allows for easy, asynchronous sending and receiving messages/commands.

A flexible protocol is used, consisting of a command, a length and a payload.

In detail, it is expected that the used TCP protocol works via exchange of byte collections. A fixed header length is assumed, so - for example - the first 5 bytes of each message encode the message header. The header in turn consists of a command (like Stop, Start, Pause, Load, …) and a length part. Command & length can be in arbitrary order (but have to be fixed for the protocol). Then the next length-many bytes which are received are the payload of the message. Further received bytes form the next message.

An example is given in the Examples.

Macros

Logs a message at the debug level.
Logs a message at the error level.
Logs a message at the info level.
The standard logging macro.
Determines if a message logged at the specified level in that module will be logged.
Logs a message at the trace level.
Logs a message at the warn level.

Structs

This is the main type of the library. Here all the logic is bundle. It can be used to easily send and receive messages via TCP, allowing for many different protcols to be used.
This bundles the time-settings for the protocol
Metadata about a log message.
The type returned by from_str when the string doesn’t match any of the log levels.
The “payload” of a log message.
Builder for Record.
The type returned by set_logger if set_logger has already been called.
The error type for a shutdown attemp.
A TCP socket server, listening for connections.
A TCP stream between a local and a remote socket.

Enums

The error type for a BusyState update
The error type for the connect-function.
An enum representing the available verbosity levels of the logger.
An enum representing the available verbosity level filters of the logger.
The error type for parsing a header which was transferred via TCP.
This enumeration is the list of the possible reasons that try_recv could not return data when called. This can occur with both a channel and a sync_channel.

Constants

The statically resolved maximum log level.

Traits

A trait encapsulating the operations required of a logger.
This trait represents the TCP-Protocol to be used.
The Read trait allows for reading bytes from a source.
A trait for objects which can be converted or resolved to one or more SocketAddr values.
A trait for objects which are byte-oriented sinks.

Functions

Returns a reference to the logger.
Returns the current maximum log level.
Sets the global logger to a Box<Log>.
Sets the global logger to a &'static Log.
A thread-unsafe version of set_logger.
Sets the global maximum log level.

Type Definitions

A type alias combining a command (as enum-variant) & a message (as byte-vector).