plaza_wire 0.7.1

The wire format trait shared by Plaza servers and clients. Pure serde, no async runtime.
Documentation
//! Generic operation payloads for presence updates.

use crate::agent::AgentId;
use serde::{Deserialize, Serialize};
use std::fmt::Debug;

/// Generic payload for an Op where a user updates their presence state.
/// The application defines what `P` (PresenceDetails) contains.
/// The `agent_id` of the user sending this update is typically derived from the `source`
/// of the `LogicInput::AgentOps` in `StateLogic`.
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(bound = "P: Serialize + for<'de2> Deserialize<'de2>")]
pub struct UpdatePresencePayload<P: Clone + Debug> {
  pub details: P,
}

/// Generic payload for an Op broadcasting presence changes to other clients.
/// Usually generated by `StateLogic` after processing an `UpdatePresencePayload`.
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(bound = "ID: Serialize + for<'de2> Deserialize<'de2>, P: Serialize + for<'de2> Deserialize<'de2>")]
pub struct PresenceChangedNoticePayload<ID: AgentId, P: Clone + Debug> {
  pub agent_id: ID,
  pub new_details: P,
}