capnweb-core
Core protocol implementation for Cap'n Web RPC - capability-based security with promise pipelining.
Overview
capnweb-core
provides the foundational types and protocol implementation for the Cap'n Web RPC system. It includes:
- Wire protocol types (Messages, Calls, Results, Errors)
- Capability ID management
- Session and connection handling
- Protocol validation and error handling
- Intermediate Language (IL) for complex operations
Features
- Capability-based security: Unforgeable references with explicit lifetime management
- Promise pipelining: Chain operations on results before they complete
- Type-safe IDs: Strongly-typed identifiers for capabilities, calls, and sessions
- Structured errors: Rich error model with proper context propagation
- Optional validation: Schema validation support via feature flag
Usage
Add to your Cargo.toml
:
[]
= "0.1.0"
Basic usage:
use ;
use json;
// Create a capability ID
let cap_id = new;
// Example: create a message
let message = Call ;
// Handle protocol messages
match message
Feature Flags
validation
(default): Enable JSON schema validationsimd
: Use SIMD-accelerated JSON parsing
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.