Skip to main content

ContractBody

Trait ContractBody 

Source
pub trait ContractBody:
    Serialize
    + DeserializeOwned
    + Clone
    + Send
    + Sync
    + 'static {
    type Api: ApiVersion;

    const FAMILY: &'static str;
    const SCHEMA_ID: &'static str;
    const TOPIC: &'static str;
}
Expand description

The contract primitive traits, re-exported from the phoxal-bus crate (the ABI floor) so they stay addressable at phoxal_api::ApiVersion / phoxal_api::ContractBody.

  • ApiVersion is the marker trait identifying one dated API version (D60), implemented only by the zero-variant enum Api {} that phoxal_api_tree! generates inside each version module; its ID is the dated module name ("y2026_1") and is carried in bus metadata as informational provenance. Its IS_PREVIEW const is lifecycle metadata only.
  • ContractBody is a version-local wire body (D61): a plain serde type bound to exactly one ApiVersion and one contract family/topic. Every body declared inside a phoxal_api_tree! node gets a generated impl; handles, SetupContext builders, and the Service/Driver derive assertions key off its Api/FAMILY/SCHEMA_ID/TOPIC. Runtime decode compatibility keys off SCHEMA_ID; its serde encoding is the wire payload, with no version envelope (D62). A version-local wire body: a plain serde type bound to exactly one ApiVersion and one contract family/topic (D61).

Every body declared inside a phoxal_api_tree! node gets a generated impl. Handles, SetupContext builders, and the Service/Driver derive assertions all key off Api/FAMILY/TOPIC, which is how a body from the wrong API version is rejected at compile time.

The serde encoding of an implementor is the wire payload; there is no version envelope (D62). Version and family travel as bus metadata, derived from Api and FAMILY.

Runtime decode compatibility keys off SCHEMA_ID, not the graph API version. SCHEMA_ID is a normalized hash of the body’s transitive wire shape. The canonical hash input is phoxal.schema/v0\n followed by this grammar:

body    = unit | newtype | tuple | struct | enum
struct  = "struct{" field* "}"
field   = "f" byte_len ":" utf8_name "=" ty ";"
enum    = "enum(" repr "){" variant* "}"
repr    = "external" | "internal(tag=" name ")"
        | "adjacent(tag=" name ",content=" name ")" | "untagged"
variant = "v" byte_len ":" utf8_name "=" payload ";"
payload = unit | "newtype(" ty ")" | tuple | struct
newtype = "newtype(" ty ")"
tuple   = "tuple(" (ty ";")* ")"
ty      = nil | bool | string | bytes | integer | float | option | seq | array
        | map | tuple | body
integer = "u8" | "u16" | "u32" | "u64" | "u128"
        | "i8" | "i16" | "i32" | "i64" | "i128"
float   = "f32" | "f64"
option  = "option(" ty ")"
seq     = "seq(" ty ")"
array   = "array[" decimal_len "](" ty ")"
map     = "map(" ty "," ty ")"
name    = byte_len ":" utf8_name

Fields stay in declared order and use their serde wire names, including rename and rename_all. Enums include serde representation mode, variant wire names, and payload shapes. Nested API-tree structs and enums are expanded transitively, with generic type parameters substituted by concrete type arguments before expansion. Only understood serde attributes and known wire-neutral attributes such as doc comments and simple derives are accepted. Non-wire details such as Rust type identifiers when the wire shape has already been expanded are excluded. The displayed id is lower-hex sha256(canonical_string), truncated to the first 16 hex characters.

Required Associated Constants§

Source

const FAMILY: &'static str

Canonical contract family id: the ::-joined node path plus the body type name, with dynamic variables excluded, e.g. "drive::State" or "component::motor::Command".

Source

const SCHEMA_ID: &'static str

Per-contract compatibility id: lower-hex SHA-256 of the canonical transitive wire-shape string, truncated to 16 hex characters.

Source

const TOPIC: &'static str

Versionless topic key: the /-joined node path plus the topic leaf, with each dynamic node contributing a {var} placeholder, e.g. "drive/state" or "component/{instance}/motor/{capability}/command". The concrete key is produced by the api-local topic builder, which fills the placeholders.

Required Associated Types§

Source

type Api: ApiVersion

The single API version this body belongs to. Two bodies from different versions have different Api, so the type system keeps them apart.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ContractBody for Clock

Source§

const FAMILY: &'static str = "simulation::Clock"

Source§

const SCHEMA_ID: &'static str = "1a4038c598a3dac2"

Source§

const TOPIC: &'static str = "simulation/clock"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::mission::Command

Source§

const FAMILY: &'static str = "mission::Command"

Source§

const SCHEMA_ID: &'static str = "68bc120004663097"

Source§

const TOPIC: &'static str = "mission/command"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::power::Command

Source§

const FAMILY: &'static str = "power::Command"

Source§

const SCHEMA_ID: &'static str = "dcdefd20c4c485ed"

Source§

const TOPIC: &'static str = "power/command"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::motor::Command

Source§

const FAMILY: &'static str = "component::motor::Command"

Source§

const SCHEMA_ID: &'static str = "790522170ea1f8f4"

Source§

const TOPIC: &'static str = "component/{instance}/motor/{capability}/command"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::led::Command

Source§

const FAMILY: &'static str = "component::led::Command"

Source§

const SCHEMA_ID: &'static str = "e05d002af8729ff0"

Source§

const TOPIC: &'static str = "component/{instance}/led/{capability}/command"

Source§

type Api = Api

Source§

impl ContractBody for Contact

Source§

const FAMILY: &'static str = "simulation::Contact"

Source§

const SCHEMA_ID: &'static str = "200769283abb0336"

Source§

const TOPIC: &'static str = "simulation/contact"

Source§

type Api = Api

Source§

impl ContractBody for Control

Source§

const FAMILY: &'static str = "simulation::Control"

Source§

const SCHEMA_ID: &'static str = "fcbdfc9e6d42d4e9"

Source§

const TOPIC: &'static str = "simulation/control"

Source§

type Api = Api

Source§

impl ContractBody for Detections

Source§

const FAMILY: &'static str = "perception::Detections"

Source§

const SCHEMA_ID: &'static str = "718008c4c81fe4e2"

Source§

const TOPIC: &'static str = "perception/detections"

Source§

type Api = Api

Source§

impl ContractBody for EmergencyStopRequest

Source§

const FAMILY: &'static str = "safety::EmergencyStopRequest"

Source§

const SCHEMA_ID: &'static str = "5ff421d098148b38"

Source§

const TOPIC: &'static str = "safety/estop"

Source§

type Api = Api

Source§

impl ContractBody for Event

Source§

const FAMILY: &'static str = "logs::Event"

Source§

const SCHEMA_ID: &'static str = "7cb8d62644f449bc"

Source§

const TOPIC: &'static str = "logs/{participant_id}"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::camera::Frame

Source§

const FAMILY: &'static str = "component::camera::Frame"

Source§

const SCHEMA_ID: &'static str = "dfb562871eedbb45"

Source§

const TOPIC: &'static str = "component/{instance}/camera/{capability}/frame"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::depth::Frame

Source§

const FAMILY: &'static str = "component::depth::Frame"

Source§

const SCHEMA_ID: &'static str = "7fe2cbf61a5f574d"

Source§

const TOPIC: &'static str = "component/{instance}/depth/{capability}/frame"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::microphone::Frame

Source§

const FAMILY: &'static str = "component::microphone::Frame"

Source§

const SCHEMA_ID: &'static str = "b0a3f1c7894ca41c"

Source§

const TOPIC: &'static str = "component/{instance}/microphone/{capability}/frame"

Source§

type Api = Api

Source§

impl ContractBody for Frontiers

Source§

const FAMILY: &'static str = "explore::Frontiers"

Source§

const SCHEMA_ID: &'static str = "042440272ebda4cb"

Source§

const TOPIC: &'static str = "explore/frontiers"

Source§

type Api = Api

Source§

impl ContractBody for GetRequest

Source§

const FAMILY: &'static str = "asset::GetRequest"

Source§

const SCHEMA_ID: &'static str = "b7057a730c599833"

Source§

const TOPIC: &'static str = "asset/get"

Source§

type Api = Api

Source§

impl ContractBody for GetResponse

Source§

const FAMILY: &'static str = "asset::GetResponse"

Source§

const SCHEMA_ID: &'static str = "6f1e618e2b1f6beb"

Source§

const TOPIC: &'static str = "asset/get"

Source§

type Api = Api

Source§

impl ContractBody for Goal

Source§

const FAMILY: &'static str = "mission::Goal"

Source§

const SCHEMA_ID: &'static str = "73fdf859b2cacda4"

Source§

const TOPIC: &'static str = "mission/goal"

Source§

type Api = Api

Source§

impl ContractBody for Heartbeat

Source§

const FAMILY: &'static str = "presence::Heartbeat"

Source§

const SCHEMA_ID: &'static str = "71dd078a4bef0e7e"

Source§

const TOPIC: &'static str = "presence/heartbeat"

Source§

type Api = Api

Source§

impl ContractBody for JointState

Source§

const FAMILY: &'static str = "joint::JointState"

Source§

const SCHEMA_ID: &'static str = "7458ccb5f1f630c2"

Source§

const TOPIC: &'static str = "joint/{joint}/state"

Source§

type Api = Api

Source§

impl ContractBody for LocalizationState

Source§

const FAMILY: &'static str = "localize::LocalizationState"

Source§

const SCHEMA_ID: &'static str = "eea128627b56225c"

Source§

const TOPIC: &'static str = "localize/state"

Source§

type Api = Api

Source§

impl ContractBody for LookupRequest

Source§

const FAMILY: &'static str = "frame::LookupRequest"

Source§

const SCHEMA_ID: &'static str = "4bfb78501cced8c1"

Source§

const TOPIC: &'static str = "frame/lookup"

Source§

type Api = Api

Source§

impl ContractBody for LookupResponse

Source§

const FAMILY: &'static str = "frame::LookupResponse"

Source§

const SCHEMA_ID: &'static str = "fce54b669641f4ce"

Source§

const TOPIC: &'static str = "frame/lookup"

Source§

type Api = Api

Source§

impl ContractBody for ManualCommand

Source§

const FAMILY: &'static str = "motion::ManualCommand"

Source§

const SCHEMA_ID: &'static str = "8749292b3e1cfcdf"

Source§

const TOPIC: &'static str = "motion/manual"

Source§

type Api = Api

Source§

impl ContractBody for OpenRequest

Source§

const FAMILY: &'static str = "video::OpenRequest"

Source§

const SCHEMA_ID: &'static str = "01d090ba7dbc333c"

Source§

const TOPIC: &'static str = "video/open"

Source§

type Api = Api

Source§

impl ContractBody for OpenResponse

Source§

const FAMILY: &'static str = "video::OpenResponse"

Source§

const SCHEMA_ID: &'static str = "4874d37430980b83"

Source§

const TOPIC: &'static str = "video/open"

Source§

type Api = Api

Source§

impl ContractBody for Path

Source§

const FAMILY: &'static str = "plan::Path"

Source§

const SCHEMA_ID: &'static str = "072c80bdd8ebc770"

Source§

const TOPIC: &'static str = "plan/path"

Source§

type Api = Api

Source§

impl ContractBody for Revision

Source§

const FAMILY: &'static str = "map::Revision"

Source§

const SCHEMA_ID: &'static str = "e3bd7ca871cb1e91"

Source§

const TOPIC: &'static str = "map/revision"

Source§

type Api = Api

Source§

impl ContractBody for RobotPose

Source§

const FAMILY: &'static str = "simulation::RobotPose"

Source§

const SCHEMA_ID: &'static str = "4a445cdf4b5362f8"

Source§

const TOPIC: &'static str = "simulation/robot_pose"

Source§

type Api = Api

Source§

impl ContractBody for SafetyAuthorization

Source§

const FAMILY: &'static str = "safety::SafetyAuthorization"

Source§

const SCHEMA_ID: &'static str = "691850b4f944b302"

Source§

const TOPIC: &'static str = "safety/authorization"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::encoder::Sample

Source§

const FAMILY: &'static str = "component::encoder::Sample"

Source§

const SCHEMA_ID: &'static str = "04beba8a261bd418"

Source§

const TOPIC: &'static str = "component/{instance}/encoder/{capability}/sample"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::accelerometer::Sample

Source§

const FAMILY: &'static str = "component::accelerometer::Sample"

Source§

const SCHEMA_ID: &'static str = "981b31474b4148bb"

Source§

const TOPIC: &'static str = "component/{instance}/accelerometer/{capability}/sample"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::gyroscope::Sample

Source§

const FAMILY: &'static str = "component::gyroscope::Sample"

Source§

const SCHEMA_ID: &'static str = "ad30fbdb012b57c3"

Source§

const TOPIC: &'static str = "component/{instance}/gyroscope/{capability}/sample"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::magnetometer::Sample

Source§

const FAMILY: &'static str = "component::magnetometer::Sample"

Source§

const SCHEMA_ID: &'static str = "48288b82685250bb"

Source§

const TOPIC: &'static str = "component/{instance}/magnetometer/{capability}/sample"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::imu::Sample

Source§

const FAMILY: &'static str = "component::imu::Sample"

Source§

const SCHEMA_ID: &'static str = "7348846ce5a9ec67"

Source§

const TOPIC: &'static str = "component/{instance}/imu/{capability}/sample"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::range::Sample

Source§

const FAMILY: &'static str = "component::range::Sample"

Source§

const SCHEMA_ID: &'static str = "af411d79bf68d44a"

Source§

const TOPIC: &'static str = "component/{instance}/range/{capability}/sample"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::gnss::Sample

Source§

const FAMILY: &'static str = "component::gnss::Sample"

Source§

const SCHEMA_ID: &'static str = "66d10a129dee8053"

Source§

const TOPIC: &'static str = "component/{instance}/gnss/{capability}/sample"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::lidar::Scan

Source§

const FAMILY: &'static str = "component::lidar::Scan"

Source§

const SCHEMA_ID: &'static str = "c31e62b8140058ec"

Source§

const TOPIC: &'static str = "component/{instance}/lidar/{capability}/scan"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::mmwave::Scan

Source§

const FAMILY: &'static str = "component::mmwave::Scan"

Source§

const SCHEMA_ID: &'static str = "07035513b2d37059"

Source§

const TOPIC: &'static str = "component/{instance}/mmwave/{capability}/scan"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::drive::State

Source§

const FAMILY: &'static str = "drive::State"

Source§

const SCHEMA_ID: &'static str = "a27f3fbed7d0269e"

Source§

const TOPIC: &'static str = "drive/state"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::battery::State

Source§

const FAMILY: &'static str = "battery::State"

Source§

const SCHEMA_ID: &'static str = "73cd0a0afc5d9708"

Source§

const TOPIC: &'static str = "battery/state"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::mission::State

Source§

const FAMILY: &'static str = "mission::State"

Source§

const SCHEMA_ID: &'static str = "a23a7c64080c758e"

Source§

const TOPIC: &'static str = "mission/state"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::power::State

Source§

const FAMILY: &'static str = "power::State"

Source§

const SCHEMA_ID: &'static str = "1eb5bd9e186c6013"

Source§

const TOPIC: &'static str = "power/state"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::motion::State

Source§

const FAMILY: &'static str = "motion::State"

Source§

const SCHEMA_ID: &'static str = "2ba3e368b40b3e83"

Source§

const TOPIC: &'static str = "motion/state"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::bus::uplink::State

Source§

const FAMILY: &'static str = "bus::uplink::State"

Source§

const SCHEMA_ID: &'static str = "730bc8aa4847a644"

Source§

const TOPIC: &'static str = "bus/uplink/state"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::plan::State

Source§

const FAMILY: &'static str = "plan::State"

Source§

const SCHEMA_ID: &'static str = "1bafc0968ce94aea"

Source§

const TOPIC: &'static str = "plan/state"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::follow::State

Source§

const FAMILY: &'static str = "follow::State"

Source§

const SCHEMA_ID: &'static str = "196afafc69158b98"

Source§

const TOPIC: &'static str = "follow/state"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::explore::State

Source§

const FAMILY: &'static str = "explore::State"

Source§

const SCHEMA_ID: &'static str = "289ac7e769392bd5"

Source§

const TOPIC: &'static str = "explore/state"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::perception::State

Source§

const FAMILY: &'static str = "perception::State"

Source§

const SCHEMA_ID: &'static str = "53a58f8bf4871c9e"

Source§

const TOPIC: &'static str = "perception/state"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::component::emergency_stop::State

Source§

const FAMILY: &'static str = "component::emergency_stop::State"

Source§

const SCHEMA_ID: &'static str = "5ff421d098148b38"

Source§

const TOPIC: &'static str = "component/{instance}/emergency_stop/{capability}/state"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::odometry::State

Source§

const FAMILY: &'static str = "odometry::State"

Source§

const SCHEMA_ID: &'static str = "2cd3469157d82c51"

Source§

const TOPIC: &'static str = "odometry/state"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::presence::State

Source§

const FAMILY: &'static str = "presence::State"

Source§

const SCHEMA_ID: &'static str = "5b19728fb8526ada"

Source§

const TOPIC: &'static str = "presence/state"

Source§

type Api = Api

Source§

impl ContractBody for StaticTransforms

Source§

const FAMILY: &'static str = "frame::StaticTransforms"

Source§

const SCHEMA_ID: &'static str = "6938a55322fb2272"

Source§

const TOPIC: &'static str = "frame/static_transforms"

Source§

type Api = Api

Source§

impl ContractBody for Status

Source§

const FAMILY: &'static str = "safety::Status"

Source§

const SCHEMA_ID: &'static str = "871976d559db5984"

Source§

const TOPIC: &'static str = "safety/state"

Source§

type Api = Api

Source§

impl ContractBody for StreamState

Source§

const FAMILY: &'static str = "video::stream::StreamState"

Source§

const SCHEMA_ID: &'static str = "bae672ca9f6d905b"

Source§

const TOPIC: &'static str = "video/stream/{stream}/state"

Source§

type Api = Api

Source§

impl ContractBody for SubmapRequest

Source§

const FAMILY: &'static str = "map::SubmapRequest"

Source§

const SCHEMA_ID: &'static str = "131992c2ffc35636"

Source§

const TOPIC: &'static str = "map/submap"

Source§

type Api = Api

Source§

impl ContractBody for SubmapResponse

Source§

const FAMILY: &'static str = "map::SubmapResponse"

Source§

const SCHEMA_ID: &'static str = "cd56e4949a176bcb"

Source§

const TOPIC: &'static str = "map/submap"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::drive::Target

Source§

const FAMILY: &'static str = "drive::Target"

Source§

const SCHEMA_ID: &'static str = "bd1db077861832a8"

Source§

const TOPIC: &'static str = "drive/target"

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::y2026_1::follow::Target

Source§

const FAMILY: &'static str = "follow::Target"

Source§

const SCHEMA_ID: &'static str = "b7164568720d477e"

Source§

const TOPIC: &'static str = "follow/target"

Source§

type Api = Api

Source§

impl ContractBody for Tree

Source§

const FAMILY: &'static str = "frame::Tree"

Source§

const SCHEMA_ID: &'static str = "6938a55322fb2272"

Source§

const TOPIC: &'static str = "frame/tree"

Source§

type Api = Api