3ea096ace9
ci / rust (push) Has been cancelled
The shared-core architecture pays off: platform clients now link ONE Rust library that does the entire lumen/1 protocol, and only add decode/present/input on top. lumen-core: - client.rs (quic feature): NativeClient — QUIC handshake + UDP data plane + input datagrams on internal threads; embedder surface = connect / next_frame / send_input. - abi.rs: lumen_connect / lumen_connection_next_au (borrow-until-next-call, matching lumen_client_poll_frame semantics) / lumen_connection_send_input / lumen_connection_mode / lumen_connection_close. Guarded in the generated header by LUMEN_FEATURE_QUIC (cbindgen [defines] mapping), so the checked-in header is stable across feature sets. - error.rs: append-only LumenStatus additions Timeout (-9) and Closed (-10). - TESTED end-to-end through the C ABI: in-process lumen/1 host, lumen_connect pulls 25 byte-verified frames, sends input, closes (m3.rs::c_abi_connection_roundtrip). Apple client (clients/apple — SCAFFOLD, written on Linux, first Xcode build pending): - scripts/build-xcframework.sh: cargo per Apple target → universal staticlib + header (LUMEN_FEATURE_QUIC pre-defined) + modulemap → LumenCore.xcframework. - Package.swift (LumenKit) + Swift sources: LumenConnection (ABI wrapper), AnnexB (in-band VPS/SPS/PPS → CMVideoFormatDescription, Annex-B → AVCC CMSampleBuffers with DisplayImmediately), StreamView (SwiftUI over AVSampleBufferDisplayLayer — stage-1 presenter that hardware-decodes compressed HEVC itself), InputCapture (GCMouse raw deltas + GCKeyboard HID→VK). - README.md is the full handoff for the next (Mac-side) agent: build steps, ABI contract, first-light test recipe against the Linux host, stage-2 (VT+Metal pacing) plan, and the known host-side gaps (single-session m3-host, no lumen/1 audio yet, gamepad kinds not yet routed in m3's injector, seed-stage trust). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
65 lines
1.8 KiB
Rust
65 lines
1.8 KiB
Rust
//! Error type and the stable C ABI status codes it maps to.
|
|
|
|
use thiserror::Error;
|
|
|
|
/// The core's internal error type. Crosses the C ABI as a [`LumenStatus`] code.
|
|
#[derive(Debug, Error)]
|
|
pub enum LumenError {
|
|
#[error("invalid argument: {0}")]
|
|
InvalidArg(&'static str),
|
|
#[error("fec error: {0}")]
|
|
Fec(#[from] crate::fec::FecError),
|
|
#[error("crypto seal/open failed")]
|
|
Crypto,
|
|
#[error("malformed packet")]
|
|
BadPacket,
|
|
#[error("no complete frame available yet")]
|
|
NoFrame,
|
|
#[error("unsupported: {0}")]
|
|
Unsupported(&'static str),
|
|
#[error("io error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
#[error("timed out")]
|
|
Timeout,
|
|
#[error("session closed")]
|
|
Closed,
|
|
}
|
|
|
|
pub type Result<T> = core::result::Result<T, LumenError>;
|
|
|
|
/// Stable C ABI status codes. `Ok` is 0; all errors are negative so callers can
|
|
/// test `rc < 0`. Do not renumber existing variants — only append.
|
|
#[repr(i32)]
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
pub enum LumenStatus {
|
|
Ok = 0,
|
|
InvalidArg = -1,
|
|
Fec = -2,
|
|
Crypto = -3,
|
|
BadPacket = -4,
|
|
NoFrame = -5,
|
|
Unsupported = -6,
|
|
Io = -7,
|
|
NullPointer = -8,
|
|
Timeout = -9,
|
|
Closed = -10,
|
|
Panic = -99,
|
|
}
|
|
|
|
impl LumenError {
|
|
/// Map to the C ABI status code.
|
|
pub fn status(&self) -> LumenStatus {
|
|
match self {
|
|
LumenError::InvalidArg(_) => LumenStatus::InvalidArg,
|
|
LumenError::Fec(_) => LumenStatus::Fec,
|
|
LumenError::Crypto => LumenStatus::Crypto,
|
|
LumenError::BadPacket => LumenStatus::BadPacket,
|
|
LumenError::NoFrame => LumenStatus::NoFrame,
|
|
LumenError::Unsupported(_) => LumenStatus::Unsupported,
|
|
LumenError::Io(_) => LumenStatus::Io,
|
|
LumenError::Timeout => LumenStatus::Timeout,
|
|
LumenError::Closed => LumenStatus::Closed,
|
|
}
|
|
}
|
|
}
|