Skip to main content

ContractBody

Trait ContractBody 

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

    const NAME: &'static str;
    const VERSION: &'static str;
    const CONTRACT: &'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 API version (D60), implemented only by the zero-variant enum Api {} that phoxal_api_tree! generates inside each version module; its ID is the module name ("v1"). 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 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/TOPIC. TOPIC is version-qualified (D1) and is the compatibility key - there is no SCHEMA_ID/FAMILY; 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 topic (D61/D1).

Every body declared inside a phoxal_api_tree! node gets a generated impl. Each body carries its own Api version marker and version-qualified TOPIC. Participant Api derives record contract bodies field by field, and setup builders require the requested handle body to be declared by that struct.

The serde encoding of an implementor is the wire payload; there is no version envelope (D62).

Wire identity is the key, not a hash (D1). The version is folded into TOPIC, so v1::drive::Target and a hypothetically re-minted v2::drive::Target publish on different Zenoh keys and physically cannot collide. There is therefore no SCHEMA_ID/FAMILY axis: two participants interoperate on a contract iff they use the exact same version-qualified name, which is realized on the wire by the key. A receiver’s per-key Zenoh subscription is the whole fast-reject; the bus decode path validates only the codec.

Required Associated Constants§

Source

const NAME: &'static str

The version-qualified type path this body’s own version module places it at: the version module name, then the ::-joined node path (dynamic-node vars are topic params, never type-path segments), then the PascalCase type leaf, e.g. "v1::drive::Target" or "v1::component::motor::Command". This is the contract’s source identity (D1) - two contracts interoperate iff they share this exact name - as distinct from TOPIC, the resolved wire key derived from it. NAME is exactly the "::"-join of VERSION and CONTRACT; it stays available for callers that want the whole identity as one string (e.g. display), while metadata recording splices the two split consts instead (coherence-gate design doc §2 - a joined name is not machine-parseable without assuming the version naming scheme).

Source

const VERSION: &'static str

This body’s version alone, e.g. "v1" - equal to <Self::Api as ApiVersion>::ID, but exposed directly on the body so a metadata recorder (#[derive(phoxal::Api)]’s linker-section splicing) can const-splice it without routing through Self::Api. Split from CONTRACT so consumers (the coherence gate, catalog) record version and contract as two separate fields rather than parsing a joined name.

Source

const CONTRACT: &'static str

This body’s contract path within its own version: the ::-joined node path (dynamic-node vars excluded, as with NAME) plus the PascalCase type leaf, e.g. "drive::Target". The logical contract - stable across a version bump - is this value alone; pairing it with VERSION recovers the full version-qualified identity (NAME).

Source

const TOPIC: &'static str

The version-qualified wire key: the version module name, then the /-joined node path plus the topic leaf, with each dynamic node contributing a {var} placeholder, e.g. "v1/drive/state" or "v1/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 NAME: &'static str = "v1::simulation::Clock"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::v1::mission::Command

Source§

const NAME: &'static str = "v1::mission::Command"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::v1::power::Command

Source§

const NAME: &'static str = "v1::power::Command"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::motor::Command"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::led::Command"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for Contact

Source§

const NAME: &'static str = "v1::simulation::Contact"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for Control

Source§

const NAME: &'static str = "v1::simulation::Control"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for Detections

Source§

const NAME: &'static str = "v1::perception::Detections"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for EmergencyStopRequest

Source§

const NAME: &'static str = "v1::safety::EmergencyStopRequest"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for Event

Source§

const NAME: &'static str = "v1::logs::Event"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::camera::Frame"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::depth::Frame"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::microphone::Frame"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for Frontiers

Source§

const NAME: &'static str = "v1::explore::Frontiers"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for GetRequest

Source§

const NAME: &'static str = "v1::asset::GetRequest"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for GetResponse

Source§

const NAME: &'static str = "v1::asset::GetResponse"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for Goal

Source§

const NAME: &'static str = "v1::mission::Goal"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for Heartbeat

Source§

const NAME: &'static str = "v1::presence::Heartbeat"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for JointState

Source§

const NAME: &'static str = "v1::joint::JointState"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for LocalizationState

Source§

const NAME: &'static str = "v1::localize::LocalizationState"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for LookupRequest

Source§

const NAME: &'static str = "v1::frame::LookupRequest"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for LookupResponse

Source§

const NAME: &'static str = "v1::frame::LookupResponse"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for ManualCommand

Source§

const NAME: &'static str = "v1::motion::ManualCommand"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for OpenRequest

Source§

const NAME: &'static str = "v1::video::OpenRequest"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for OpenResponse

Source§

const NAME: &'static str = "v1::video::OpenResponse"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for Path

Source§

const NAME: &'static str = "v1::plan::Path"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for Revision

Source§

const NAME: &'static str = "v1::map::Revision"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for RobotPose

Source§

const NAME: &'static str = "v1::simulation::RobotPose"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for SafetyAuthorization

Source§

const NAME: &'static str = "v1::safety::SafetyAuthorization"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::encoder::Sample"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::accelerometer::Sample"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::gyroscope::Sample"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::magnetometer::Sample"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::imu::Sample"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::range::Sample"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::gnss::Sample"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::lidar::Scan"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::mmwave::Scan"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::v1::drive::State

Source§

const NAME: &'static str = "v1::drive::State"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::v1::mission::State

Source§

const NAME: &'static str = "v1::mission::State"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::v1::power::State

Source§

const NAME: &'static str = "v1::power::State"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::v1::motion::State

Source§

const NAME: &'static str = "v1::motion::State"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::bus::uplink::State"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::v1::plan::State

Source§

const NAME: &'static str = "v1::plan::State"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::v1::follow::State

Source§

const NAME: &'static str = "v1::follow::State"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::v1::explore::State

Source§

const NAME: &'static str = "v1::explore::State"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::v1::perception::State

Source§

const NAME: &'static str = "v1::perception::State"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

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

Source§

const NAME: &'static str = "v1::component::emergency_stop::State"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::v1::odometry::State

Source§

const NAME: &'static str = "v1::odometry::State"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::v1::presence::State

Source§

const NAME: &'static str = "v1::presence::State"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for StaticTransforms

Source§

const NAME: &'static str = "v1::frame::StaticTransforms"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for Status

Source§

const NAME: &'static str = "v1::safety::Status"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for StreamState

Source§

const NAME: &'static str = "v1::video::stream::StreamState"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for SubmapRequest

Source§

const NAME: &'static str = "v1::map::SubmapRequest"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for SubmapResponse

Source§

const NAME: &'static str = "v1::map::SubmapResponse"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::v1::drive::Target

Source§

const NAME: &'static str = "v1::drive::Target"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for phoxal_api::v1::follow::Target

Source§

const NAME: &'static str = "v1::follow::Target"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api

Source§

impl ContractBody for Tree

Source§

const NAME: &'static str = "v1::frame::Tree"

Source§

const VERSION: &'static str = "v1"

Source§

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

Source§

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

Source§

type Api = Api