Crate async_proto[][src]

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

The following features can be enabled via Cargo:

  • blocking: Shorthand for enabling both read-sync and write-sync.
  • chrono-tz: Adds a dependency on the chrono-tz crate and implements Protocol for its Tz type.
  • read-sync: Adds a blocking read_sync method to the Protocol trait.
  • serde_json: Adds a dependency on the serde_json crate and implements Protocol for its Value, Map, and Number types.
  • tokio-tungstenite: Adds a dependency on the tokio-tungstenite crate and convenience methods for reading/writing Protocol types from/to its websockets.
  • warp: Adds a dependency on the warp crate and convenience methods for reading/writing Protocol types from/to its websockets.
  • write-sync: Adds a blocking write_sync method to the Protocol trait.

Enums

The error returned from the read and read_sync methods.

The error returned from the write and write_sync methods.

Traits

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.

Derive Macros

Implements the Protocol trait for this type.