Skip to main content

MessageType

Enum MessageType 

Source
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 ExecExitedExecFailed 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

Source

pub fn flags(&self) -> u8

Computes the frame flags byte for this message type.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> MessageType

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for MessageType

Source§

impl Debug for MessageType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for MessageType

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for MessageType

Source§

impl<'_derivative_strum> From<&'_derivative_strum MessageType> for &'static str

Source§

fn from(x: &'_derivative_strum MessageType) -> &'static str

Converts to this type from the input type.
Source§

impl From<MessageType> for &'static str

Source§

fn from(x: MessageType) -> &'static str

Converts to this type from the input type.
Source§

impl FromStr for MessageType

Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<MessageType, <Self as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for MessageType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoEnumIterator for MessageType

Source§

impl PartialEq for MessageType

Source§

fn eq(&self, other: &MessageType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for MessageType

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for MessageType

Source§

impl TryFrom<&str> for MessageType

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(s: &str) -> Result<MessageType, <Self as TryFrom<&str>>::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.