Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Bloop Protocol
Core implementation of the Bloop wire protocol (version 3), the binary request-response protocol spoken between Bloop clients (e.g. Bloop Boxes) and Bloop servers over TLS.
This crate is the single source of truth for the wire format. Server and client frameworks, as well as custom clients, build on it instead of hand-implementing framing and message layouts. The written specification lives in the protocol-spec repository.
Layers
- Frames (
frame): every message ismessage_type: u8followed by a little-endianu32payload length and the payload.read_frameandwrite_framemoveRawMessagevalues over async streams, with a configurable maximum payload length on the read side. - Payload codec (
codec): theEncodeandDecodetraits map values onto the packed payload layout. Implementations exist for the spec's primitives (integers, strings, UUIDs, IP addresses, NFC UIDs, data hashes); message structs derive both. - Message sets (
set,message): aMessageSetdispatches raw frames into typed messages by opcode.ClientMessageandServerMessagecover the standard protocol and take an extension set as a type parameter for custom messages.
Defining custom messages
Extensions own the opcode range 0x80 and above. A custom message is a
derived struct; a message set groups them per wire direction:
use ;
// Plugs into the standard client-to-server set:
type Request = ;
Fields encode in declaration order. Collections carry their count prefix width explicitly, matching the spec's two widths:
The MessageSet derive checks at compile time that opcodes are unique and,
for extension sets, outside the reserved standard range. The standard
ClientMessage/ServerMessage enums are built with the same derive: a
variant holding a generic parameter (their Custom(Ext)) acts as a
catch-all that delegates to the plugged-in extension set.
Reading and writing frames
use ;
// Client side: encode and send, then await the response.
let frame = message.encode?;
write_frame.await?;
// Server side: read and dispatch.
let frame = read_frame.await?;
let message = decode?;
Unknown opcodes and malformed payloads are distinct errors
(MessageSetError::UnknownOpcode vs Malformed), so a server can answer an
unexpected message gracefully instead of dropping the connection.
Features
| Feature | Description |
|---|---|
hex |
Hex parsing (FromHex) for NFC UIDs and data hashes |
md5 |
Conversion from md5::Digest into DataHash |
serde |
Serde support, representing NFC UIDs and data hashes as hex strings (implies hex) |
Workspace
bloop-protocol: the protocol implementation.bloop-protocol-derive: theEncode,Decode,PayloadandMessageSetderive macros, re-exported bybloop-protocol.