pub enum MessageType {
Show 26 variants
Ready,
InitResolved,
InitAck,
Shutdown,
RelayClientDisconnected,
ClockSync,
ExecRequest,
ExecStarted,
ExecStdin,
ExecStdinError,
ExecStdout,
ExecStderr,
ExecExited,
ExecFailed,
ExecResize,
ExecSignal,
FsRequest,
FsResponse,
FsData,
TcpConnect,
TcpConnected,
TcpData,
TcpEof,
TcpClose,
TcpClosed,
TcpFailed,
}Expand description
Identifies the type of a protocol message.
The #[strum(serialize = ...)] attribute on each variant is the single
source for its wire string: as_str and
from_wire_str are derived from it, and
strum::IntoEnumIterator yields every variant for exhaustive iteration
(the schema snapshot) without a hand-maintained list.
Variants§
Ready
Guest agent is ready.
InitResolved
Guest reports init context before user mounts.
InitAck
Host acknowledges init-context setup.
Shutdown
Host requests shutdown.
RelayClientDisconnected
Host relay reports that one SDK client disconnected.
ClockSync
Host asks the guest to synchronize CLOCK_REALTIME.
ExecRequest
Host requests command execution.
ExecStarted
Guest confirms command started.
ExecStdin
Host sends stdin data.
ExecStdinError
Guest reports that a prior ExecStdin write to the child’s
stdin failed (e.g. the child closed its read end). Non-terminal:
the session continues and may still produce stdout/stderr and
an exit code.
ExecStdout
Guest sends stdout data.
ExecStderr
Guest sends stderr data.
ExecExited
Guest reports command exit.
ExecFailed
Guest reports command failed to spawn (binary not found,
permission denied, etc.). Distinct from ExecExited —
ExecFailed means the user code never ran. Terminal.
ExecResize
Host requests PTY resize.
ExecSignal
Host sends signal to process.
FsRequest
Host requests a filesystem operation.
FsResponse
Guest sends a terminal filesystem response.
FsData
Streaming file data chunk (bidirectional).
TcpConnect
Host requests a TCP connection from inside the guest.
TcpConnected
Guest confirms that a TCP connection was opened.
TcpData
TCP stream data chunk (bidirectional).
TcpEof
One TCP stream side has closed its write half.
TcpClose
Host requests a TCP session close.
TcpClosed
Guest reports that a TCP session is closed. Terminal.
TcpFailed
Guest reports that a TCP session failed. Terminal.
Implementations§
Source§impl MessageType
impl MessageType
Sourcepub fn min_protocol_version(&self) -> u8
pub fn min_protocol_version(&self) -> u8
The protocol generation that introduced this message type.
A per-type label on the single protocol generation axis (see
VERSIONING.md), not a separate version counter. The send path gates on
it: a type whose generation exceeds the peer’s negotiated generation is
rejected locally with a typed error instead of being sent to a peer that
cannot handle it, so only that one feature fails rather than the session.
Core and exec types belong to the generation-1 baseline; they work on
every runtime we still talk to, including the pre-0.5 legacy one.
Filesystem streaming did not exist in the pre-0.5 legacy protocol
(generation 1), so the Fs* types require generation 2 or newer.
There is deliberately no wildcard arm: adding a new MessageType must
force a conscious choice of the generation that introduced it (and a
matching PROTOCOL_VERSION bump). Message types are append-only — never
lower or re-purpose an existing value.
Sourcepub fn is_available_at(&self, peer_generation: u8) -> bool
pub fn is_available_at(&self, peer_generation: u8) -> bool
Whether a peer that speaks peer_generation is new enough to handle this
message type.
The shared version-compatibility primitive for both directions. The host
gates its sends on it (AgentClient::ensure_version_compat); the guest
can gate a guest-initiated message the same way, reading the peer’s
generation from the v field of the request that established the session.
See VERSIONING.md.
Sourcepub fn as_str(&self) -> &'static str
pub fn as_str(&self) -> &'static str
Returns the wire string representation.
Backed by the per-variant #[strum(serialize = ...)] attribute, the
single source of truth for wire strings.
Sourcepub fn from_wire_str(s: &str) -> Option<Self>
pub fn from_wire_str(s: &str) -> Option<Self>
Parses a wire string into a message type, the inverse of
as_str. Returns None for an unknown string.
Trait Implementations§
Source§impl Clone for MessageType
impl Clone for MessageType
Source§fn clone(&self) -> MessageType
fn clone(&self) -> MessageType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MessageType
Source§impl Debug for MessageType
impl Debug for MessageType
Source§impl<'de> Deserialize<'de> for MessageType
impl<'de> Deserialize<'de> for MessageType
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>,
impl Eq for MessageType
Source§impl<'_derivative_strum> From<&'_derivative_strum MessageType> for &'static str
impl<'_derivative_strum> From<&'_derivative_strum MessageType> for &'static str
Source§fn from(x: &'_derivative_strum MessageType) -> &'static str
fn from(x: &'_derivative_strum MessageType) -> &'static str
Source§impl From<MessageType> for &'static str
impl From<MessageType> for &'static str
Source§fn from(x: MessageType) -> &'static str
fn from(x: MessageType) -> &'static str
Source§impl FromStr for MessageType
impl FromStr for MessageType
Source§impl Hash for MessageType
impl Hash for MessageType
Source§impl IntoEnumIterator for MessageType
impl IntoEnumIterator for MessageType
type Iterator = MessageTypeIter
fn iter() -> MessageTypeIter ⓘ
Source§impl PartialEq for MessageType
impl PartialEq for MessageType
Source§fn eq(&self, other: &MessageType) -> bool
fn eq(&self, other: &MessageType) -> bool
self and other values to be equal, and is used by ==.