17 releases (stable)
| new 4.2.0 | Mar 9, 2026 |
|---|---|
| 4.1.0 | Mar 6, 2026 |
| 4.0.3 | Feb 22, 2026 |
| 3.5.0 | Feb 19, 2026 |
| 0.1.8 | Jan 22, 2026 |
#1750 in Network programming
44 downloads per month
Used in 15 crates
(14 directly)
185KB
4.5K
SLoC
clasp-core
Core types and encoding for the CLASP (Creative Low-Latency Application Streaming Protocol).
Features
- Message Types: Set, Publish, Subscribe, Bundle, Snapshot, etc.
- Value Types: Int, Float, Bool, String, Bytes, Array, Map, Null
- Binary Encoding (v3): 55% smaller, 4x faster than JSON/MessagePack
- Address Patterns: Hierarchical addressing with wildcards (
*,**) - Signal Types: Param, Event, Stream, Gesture, Timeline
Usage
use clasp_core::{Message, SetMessage, Value, codec};
// Create a set message
let msg = Message::Set(SetMessage {
address: "/lights/front/brightness".to_string(),
value: Value::Float(0.75),
revision: None,
lock: false,
unlock: false,
ttl: Some(Ttl::Sliding(60)), // optional per-message TTL (60s sliding)
});
// Encode to v3 binary format
let encoded = codec::encode(&msg).unwrap();
// Decode (auto-detects v2/v3)
let (decoded, _frame) = codec::decode(&encoded).unwrap();
Binary Encoding
CLASP binary encoding is 55% smaller and 4-7x faster than JSON/MessagePack:
| Metric | JSON | CLASP Binary |
|---|---|---|
| SET size | ~80 bytes | 31 bytes |
| Encode | ~2M msg/s | 8M msg/s |
| Decode | ~2M msg/s | 11M msg/s |
Address Patterns
CLASP uses hierarchical addresses with wildcard support:
| Pattern | Matches |
|---|---|
/lights/front |
Exact match |
/lights/* |
Single segment wildcard |
/lights/** |
Multi-segment wildcard |
/lights/zone5* |
Embedded wildcard |
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Maintained by LumenCanvas
Dependencies
~1.6–2.6MB
~49K SLoC