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;
Modules§
- document
- The reply document a reply’s events rebuild. Every
Wirenames oneReassembletype. The driver hands it each event its decoder classifies as known, of a reply whose transport reported no whole document, before the decoder decodes the event, and records what it finishes with as the reply’sraw. A completion decoder cannot writerawitself, so a streamed reply’srawhas one owner per wire. A wire names a reassembler only for an operation itServes, andUnreassembled, which records nothing, serves no completion.
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.
- Document
Decoder - The decoder of a reply that is one document:
classifyreads the document, andendmakes it the operation’s end. - 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
'idbrand ties it to that one reply: a writer cannot be kept past the decode step that received it. - Prepared
- What a model keeps from preparing one request for the next
(
Descriptor::prepared): a completion’s history as it was last adapted, so a history that grew is adapted only from its last turn on. A model’s clones share it. - Reply
- What the driver learned about a reply beyond its events.
- Secret
- Credential whose
Debugand serialized form contain only[redacted]. Equality compares the stored value;Self::exposereturns it unredacted. Deserializing[redacted]produces an empty credential. Callers must supply credentials again after reloading serialized configuration. - Wire
Citation - A citation as the provider stated it.
- Wire
Span - Offsets into a text block as the provider counts them.
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::endmakes anEnded. - 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.
- Span
Unit - What a provider’s offsets count.
- Wire
Event - One classified wire frame.
- Wire
Frame - 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:
FreeorAssembled. 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.
Functions§
- decode_
reply - One reply of
wiretorequest, decoded from frames already in hand as a live call inmodewould decode them: through the wire’s decoder, reassembler and fold, with no transport. A reply that arrives some other way, such as a batch result’s body (WireFrame::Bytes, unary) or a recorded stream, becomes an ordinary response.rawis what the wire’s reassembler rebuilds from the frames, and the request is the one sent, asWire::encodetook it.
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.