Skip to main content

Module wire

Module wire 

Source
Expand description

Operations, provider wires and their decoders. An Operation names what goes in, what comes out event by event and what ends a reply, and its Fold turns one reply’s events and end into the response. A Wire describes a provider endpoint as plain data, encodes requests without transport access, and names a fresh Decoder for each reply. A decoder is told nothing about how the reply arrives, so buffered and streamed replies go through the same decoder and fold.

use rig_core::wire::WireFrame;

let frame = WireFrame::Bytes(b"response".to_vec());
assert_eq!(frame.as_str(), "response");

Re-exports§

pub use crate::observe::AdapterErrorEnvelope;
pub use crate::observe::AdapterEvent;
pub use crate::observe::AdapterUsage;
pub use crate::observe::AdapterVerdict;
pub use crate::observe::ObservationSink;

Structs§

Call
What the driver knows about a call before its first frame.
Capabilities
What a runtime accounts for about a model. Each field matters to the operations that name it and is left at its default by the others.
Descriptor
What a wire says about itself: plain data, read before every call.
Encoded
The request a wire sends, and how its reply is framed.
Ended
Proof that a decoder ended its reply with Out::end.
Json
The decoder of a reply that is one JSON document: the document is the operation’s end, and is kept as the reply’s raw.
Out
Where a decoder writes one reply. The 'id brand ties it, and every part handle it hands out, to that one reply: a handle cannot be used with another reply’s writer or kept past its own.
Reply
What the driver learned about a reply beyond its events.
Secret
Credential whose Debug and serialized form contain only [redacted]. Equality compares the stored value; Self::expose returns it unredacted. Deserializing [redacted] produces an empty credential. Callers must supply credentials again after reloading serialized configuration.

Enums§

Assembled
Events only the completion writer’s part handles build.
Body
A request body: bytes, or a multipart form for the upload endpoints.
Flow
Whether a decoder step left the reply open. Only Out::end makes an Ended.
Framing
How a reply’s bytes are split into wire frames.
Free
Events a decoder builds and writes with Out::event.
Mode
Reply mode used by the wire to select request encoding and framing.
WireEvent
One classified wire frame.
WireFrame
One transport frame, after framing but before decoding.

Traits§

Decoder
Synchronous state machine for one reply. It classifies frames and decodes known events into the reply’s writer, without transport access and without being told how the reply arrives. HTTP wires read WireFrames; other transports name their own frame type.
Emit
Who builds an operation’s events: Free or Assembled. Sealed.
Fold
One reply’s state for an operation.
Operation
An operation: what goes in, what comes out event by event, what ends a reply, and how those fold into one response.
Wire
A provider endpoint: plain data that encodes requests and names a decoder for each reply.

Type Aliases§

Event
A wire’s event type.
Projector
Reads one raw payload’s observation facts (verdicts, usage, ids, error envelopes) through the sink. Text it forwards goes through ObservationSink::scrub: a payload can echo credentials.
Request
A wire’s request type.
Response
A wire’s response type.