this repo has no description
at main 143 lines 2.8 kB view raw view rendered
1# Jacquard Magic 2 3Making atproto actually easy with Rust 4 5--- 6 7# @nonbinary.computer 8 9- Embedded (and everything else) developer, electronics designer 10- Utopian in the Terra Ignota sense 11- atproto hit me like a truck 12 13--- 14 15## Spite-driven development 16 17- Existing atproto libraries kinda sucked to work with 18- Couple of notable exceptions, but none in Rust 19- Put a project on hold because I got frustrated with atrium 20- Friends working on atproto stuff in Rust had similar frustrations 21 22--- 23 24## Code Generation 25 26- Going from lexicon to app, generate API bindings 27- Then spend way more time (or LLM tokens) writing code around them to make them usable 28 29--- 30 31Not just an atproto problem, but hurts more here, especially for those not wanting to just play in Bluesky's sandbox. 32 33--- 34 35# We don't have to live like this 36 37 38--- 39 40## Why Rust? 41- The things Rust asks of you are things you often need to think about anyway 42- It just makes them explicit 43- We can make the sharp edges easier, if we care to 44 45--- 46 47# We don't have to live like this! 48 49--- 50 51# "Parse, don't validate" considered harmful 52 53Jacquard has its `Data<S>` type to handle some classes of this, 54 55to work with freeform data in useful ways, 56 57but it doesn't handle the scenario where you have something that almost 58 59but not quite fits a lexicon. 60 61--- 62 63# Smart constraints 64 65## The wonderful 'handle.invalid' 66 67- Handles are common! 68- You need to process lots of them 69- 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. 70 71--- 72 73# Smart constraints 74 75`Data<S>` is **less** useless but still sucks donkey balls when you wanted your type. 76 77--- 78 79![](avasarala.jpg) 80 81--- 82 83# Smart constraints 84 85And that is why jacquard's handle constructor has a specific carveout for 'handle.invalid' 86 87Because there's a time to follow the spec 88 89And there's a time to refrain 90 91--- 92 93## Jacquard 94 95- Typestates that work for you 96- As pluggable as possible 97- Good defaults 98- Generated code you can just use, that's readable, easy to work with 99 100--- 101 102## Why borrowing and lifetimes everywhere 103 104 105- Lifetimes (Jacquard, `serde_json_borrow`) 106- Unsafe (wrapped up, like `zerocopy` crate) 107- Separate borrowed/owned type variants (what Rust does) 108- `bytemuck` approach (`&'a Did` and `Box<Did>`) 109- **Borrow or Share** (available on `bos-beta` branch on tangled) 110 111 112--- 113 114## What you're seeing 115 116- Each dot is a Jetstream event 117- When you select one, we hit 118 - Constellation for interactions 119 - Slingshot for records 120 - Bluesky appview for profiles 121 122--- 123 124# But... 125 126- We can change that! 127 128![](example-derive.png) 129 130--- 131 132## HOW? 133 134- Standing upon the shoulders of giants here 135- **subsecond** library 136- Bevy engine with hot-patching 137- Jacquard beta that makes lifetimes optional 138 139--- 140 141## Thank you 142 143![Questions?](qr-code.png)