shape-runtime 0.3.0

Bytecode compiler, builtins, and runtime infrastructure for Shape
Documentation
/// @module std::core::transport
/// Transport Interface for Distributed Shape
///
/// Defines the abstract transport layer for inter-node communication.
/// Reference implementations (TCP, QUIC) are provided as Rust extensions.

/// Abstract transport for sending payloads to remote nodes.
pub type Transport {
    /// Human-readable name of this transport implementation.
    name: string,
}

/// An established connection to a remote node.
pub type Connection {
    /// The remote address this connection is established to.
    destination: string,
    /// Whether the connection is currently open.
    is_open: bool,
}

/// Send a payload to a destination and wait for a response.
builtin fn send(transport: Transport, destination: string, payload: Vec<int>) -> Result<Vec<int>, string>;

/// Establish a persistent connection to a remote node.
builtin fn connect(transport: Transport, destination: string) -> Result<Connection, string>;

/// Send data over an established connection.
builtin fn connection_send(conn: Connection, payload: Vec<int>) -> Result<(), string>;

/// Receive data from an established connection.
/// Timeout is in milliseconds; None means wait indefinitely.
builtin fn connection_recv(conn: Connection, timeout: int?) -> Result<Vec<int>, string>;

/// Close an established connection.
builtin fn connection_close(conn: Connection) -> Result<(), string>;

/// Create a TCP transport instance.
builtin fn tcp() -> Transport;

/// Create a QUIC transport instance (multiplexed, encrypted).
builtin fn quic() -> Transport;