| Crates.io | clasp-core |
| lib.rs | clasp-core |
| version | 3.1.0 |
| created_at | 2026-01-16 04:31:23.91384+00 |
| updated_at | 2026-01-25 07:22:29.039187+00 |
| description | Core types and encoding for CLASP protocol |
| homepage | https://clasp.to |
| repository | https://github.com/lumencanvas/clasp |
| max_upload_size | |
| id | 2047892 |
| size | 311,828 |
Core types and encoding for the CLASP (Creative Low-Latency Application Streaming Protocol).
*, **)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,
});
// Encode to v3 binary format
let encoded = codec::encode(&msg).unwrap();
// Decode (auto-detects v2/v3)
let (decoded, _frame) = codec::decode(&encoded).unwrap();
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 |
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 |
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Maintained by LumenCanvas