Crate async_proto

Source
Expand description

This is async-proto, a library crate facilitating simple binary network protocols with async support.

The main feature is the Protocol trait, which allows reading a value of an implementing type from an async or sync stream, as well as writing one to an async or sync sink.

Protocol can be derived for enums and structs if all fields implement Protocol.

§Features

This crate offers optional dependencies on the following crates to enable Protocol implementations for some of their types:

Additionally, this crate offers optional dependencies on the tokio-tungstenite crate to add convenience methods for reading/writing Protocol types from/to its websockets. The following versions are supported:

Macros§

bitflags
Implements Protocol for a type defined using the bitflags::bitflags macro.

Structs§

ReadError
The error returned from the read and read_sync methods.
WriteError
The error returned from the write and write_sync methods.

Enums§

ErrorContext
Provides additional information about the origin of an error.
ReadErrorKind
Specifies what went wrong while reading (receiving) a value.
WriteErrorKind
Specifies what went wrong while writing (sending) a value.

Traits§

Protocol
This trait allows reading a value of an implementing type from an async or sync stream, as well as writing one to an async or sync sink.

Functions§

websocket021tokio-tungstenite021
Establishes a WebSocket connection to the given URL and returns a typed sink/stream pair.
websocket024tokio-tungstenite024
Establishes a WebSocket connection to the given URL and returns a typed sink/stream pair.
websocket026tokio-tungstenite026
Establishes a WebSocket connection to the given URL and returns a typed sink/stream pair.

Derive Macros§

Protocol
Implements the Protocol trait for this type.