# Jacquard Magic Making atproto actually easy with Rust --- # @nonbinary.computer - Embedded (and everything else) developer, electronics designer - Utopian in the Terra Ignota sense - atproto hit me like a truck --- ## Spite-driven development - Existing atproto libraries kinda sucked to work with - Couple of notable exceptions, but none in Rust - Put a project on hold because I got frustrated with atrium - Friends working on atproto stuff in Rust had similar frustrations --- ## Code Generation - Going from lexicon to app, generate API bindings - Then spend way more time (or LLM tokens) writing code around them to make them usable --- Not just an atproto problem, but hurts more here, especially for those not wanting to just play in Bluesky's sandbox. --- # We don't have to live like this --- ## Why Rust? - The things Rust asks of you are things you often need to think about anyway - It just makes them explicit - We can make the sharp edges easier, if we care to --- # We don't have to live like this! --- # "Parse, don't validate" considered harmful Jacquard has its `Data` type to handle some classes of this, to work with freeform data in useful ways, but it doesn't handle the scenario where you have something that almost but not quite fits a lexicon. --- # Smart constraints ## The wonderful 'handle.invalid' - Handles are common! - You need to process lots of them - If you choke at the deserialization stage bc one post in a list has an author who's handle is invalid, that's not good as a user experience. --- # Smart constraints `Data` is **less** useless but still sucks donkey balls when you wanted your type. --- ![](avasarala.jpg) --- # Smart constraints And that is why jacquard's handle constructor has a specific carveout for 'handle.invalid' Because there's a time to follow the spec And there's a time to refrain --- ## Jacquard - Typestates that work for you - As pluggable as possible - Good defaults - Generated code you can just use, that's readable, easy to work with --- ## Why borrowing and lifetimes everywhere - Lifetimes (Jacquard, `serde_json_borrow`) - Unsafe (wrapped up, like `zerocopy` crate) - Separate borrowed/owned type variants (what Rust does) - `bytemuck` approach (`&'a Did` and `Box`) - **Borrow or Share** (available on `bos-beta` branch on tangled) --- ## What you're seeing - Each dot is a Jetstream event - When you select one, we hit - Constellation for interactions - Slingshot for records - Bluesky appview for profiles --- # But... - We can change that! ![](example-derive.png) --- ## HOW? - Standing upon the shoulders of giants here - **subsecond** library - Bevy engine with hot-patching - Jacquard beta that makes lifetimes optional --- ## Thank you ![Questions?](qr-code.png)