pub struct AgentMessage {
pub version: String,
pub payload: AgentPayload,
}Expand description
One agent → renderer message.
Fields§
§version: StringProtocol version stamped on the wire; defaults to
PROTOCOL_VERSION.
payload: AgentPayloadThe single payload key that gives this message its type.
Implementations§
Source§impl AgentMessage
impl AgentMessage
Sourcepub fn new(payload: AgentPayload) -> Self
pub fn new(payload: AgentPayload) -> Self
Wraps a payload with the current protocol version.
Sourcepub fn create_surface(
surface_id: impl Into<String>,
catalog_id: impl Into<String>,
) -> Self
pub fn create_surface( surface_id: impl Into<String>, catalog_id: impl Into<String>, ) -> Self
createSurface: allocate a surface and fix its catalogId.
Re-creating a surfaceId that already exists is an error per spec; see
crate::toolkit::ops::assemble_ops, which omits this message when the
intent is to update an existing surface.
Sourcepub fn update_components(
surface_id: impl Into<String>,
components: Vec<Component>,
) -> Self
pub fn update_components( surface_id: impl Into<String>, components: Vec<Component>, ) -> Self
updateComponents: add or replace components on an existing surface.
Sourcepub fn update_data_model(
surface_id: impl Into<String>,
path: impl Into<String>,
value: Value,
) -> Self
pub fn update_data_model( surface_id: impl Into<String>, path: impl Into<String>, value: Value, ) -> Self
updateDataModel: upsert value at path (JSON Pointer, / = whole model).
Sourcepub fn delete_surface(surface_id: impl Into<String>) -> Self
pub fn delete_surface(surface_id: impl Into<String>) -> Self
deleteSurface: drop a surface and everything under it.
Sourcepub fn surface_id(&self) -> Option<&str>
pub fn surface_id(&self) -> Option<&str>
The surfaceId this message targets, if it targets one.
Function-call messages are addressed by functionCallId rather than by
surface, so they return None.
Trait Implementations§
Source§impl Clone for AgentMessage
impl Clone for AgentMessage
Source§fn clone(&self) -> AgentMessage
fn clone(&self) -> AgentMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AgentMessage
impl Debug for AgentMessage
Source§impl<'de> Deserialize<'de> for AgentMessage
impl<'de> Deserialize<'de> for AgentMessage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for AgentMessage
impl PartialEq for AgentMessage
Source§fn eq(&self, other: &AgentMessage) -> bool
fn eq(&self, other: &AgentMessage) -> bool
self and other values to be equal, and is used by ==.