Skip to main content

Crate switchback_codec_pb

Crate switchback_codec_pb 

Source
Expand description

Reference binary codec for the switchback artifact.

switchback-codec-pb implements [SwitchbackCodec] and [SyncSwitchbackCodec] from switchback-traits using buffa-generated types compiled from switchback.proto (canardleteer.switchback.v1alpha1). See ADR 0003 for wire-format policy.

§Protocol sub-schemas

Transport metadata uses ProtocolAttachment envelopes on contract and entity nodes. Payload bytes encode one arm of a protocol-package oneof; the core schema does not import those packages.

Compiled protoGenerated Rust module
protocol/http/v1alpha1/http.protocanardleteer::switchback::protocol::http::v1alpha1
protocol/grpc/v1alpha1/grpc.protocanardleteer::switchback::protocol::grpc::v1alpha1
protocol/grpc/v1alpha1/metadata_options.protosame gRPC module (MethodOptions extension)
protocol/kafka/v1alpha1/kafka.protocanardleteer::switchback::protocol::kafka::v1alpha1
protocol/amqp/v1alpha1/amqp.protocanardleteer::switchback::protocol::amqp::v1alpha1
protocol/mqtt/v1alpha1/mqtt.protocanardleteer::switchback::protocol::mqtt::v1alpha1

Entity attachment matrix and decode steps: ADR 0011. HTTP streaming and gRPC metadata authoring: ADR 0012. Application code should prefer the switchback-protocols ProtocolRegistry for encode/decode.

§Example

use switchback_codec_pb::ProtobufCodec;
use switchback_traits::{ReferenceManual, SyncSwitchbackCodec};

let manual = ReferenceManual {
    switchback_version: "v1alpha1".into(),
    title: "Example".into(),
    ..Default::default()
};
let codec = ProtobufCodec;
let bytes = codec.serialize(&manual).unwrap();
let round_trip = codec.deserialize(&bytes).unwrap();
assert_eq!(round_trip.title, "Example");

Wire message types live under canardleteer::switchback::v1alpha1.

Re-exports§

pub use convert::WIRE_VERSION;

Modules§

canardleteer
Buffa-generated protobuf types, namespaced by protobuf package path. Protobuf package prefix canardleteer.*.
convert
Low-level protobuf conversion between seam model types and wire messages. Bidirectional mapping between seam model types and protobuf messages.

Structs§

ProtobufCodec
Reference protobuf codec using buffa-generated types from canardleteer.switchback.v1alpha1.

Constants§

DEFAULT_SWITCHBACK_FILENAME
Default on-disk filename for a switchback binary file.