A better Rust ATProto crate
99
fork

Configure Feed

Select the types of activity you want to include in your feed.

dropped some duplicate docstrings

Orual 4b830e84 298b03bb

+33 -18
+2 -1
.tangled/workflows/build.yml
··· 14 14 - name: check basic wasm compatibility 15 15 command: | 16 16 rustup target add wasm32-unknown-unknown 17 - cargo install --locked cargo-nextest 17 + 18 18 cargo build -p jacquard-common \ 19 19 --target wasm32-unknown-unknown \ 20 20 --features=websocket,reqwest-client \ ··· 22 22 23 23 - name: run tests 24 24 command: | 25 + cargo install --locked cargo-nextest 25 26 cargo nextest run --workspace --exclude mini-moka-wasm 26 27 27 28 - name: run tests
-4
crates/jacquard-common/src/lib.rs
··· 227 227 /// Trait for taking ownership of most borrowed types in jacquard. 228 228 pub mod into_static; 229 229 pub mod error; 230 - /// HTTP client abstraction used by jacquard crates. 231 230 pub mod http_client; 232 231 pub mod macros; 233 - /// Service authentication JWT parsing and verification. 234 232 #[cfg(feature = "service-auth")] 235 233 pub mod service_auth; 236 - /// Generic session storage traits and utilities. 237 234 pub mod session; 238 235 /// Baseline fundamental AT Protocol data types. 239 236 pub mod types; 240 237 // XRPC protocol types and traits 241 238 pub mod opt_serde_bytes_helper; 242 239 pub mod serde_bytes_helper; 243 - /// Stream abstractions for HTTP request/response bodies. 244 240 #[cfg(feature = "streaming")] 245 241 pub mod stream; 246 242 pub mod xrpc;
-2
crates/jacquard-common/src/types.rs
··· 11 11 pub mod cid; 12 12 /// Repository collection trait for records 13 13 pub mod collection; 14 - /// Crypto helpers for keys (Multikey decoding, conversions) 15 14 pub mod crypto; 16 15 /// AT Protocol datetime string type 17 16 pub mod datetime; ··· 23 22 pub mod handle; 24 23 /// AT Protocol identifier types (handle or DID) 25 24 pub mod ident; 26 - /// Integer type with validation 27 25 pub mod integer; 28 26 /// Language tag types per BCP 47 29 27 pub mod language;
+29 -4
crates/jacquard-common/src/types/value/convert.rs
··· 1 - use crate::IntoStatic; 2 1 use crate::types::cid::CidLink; 3 2 use crate::types::{ 4 3 DataModelType, ··· 6 5 string::AtprotoStr, 7 6 value::{Array, Data, Object, RawData, parsing}, 8 7 }; 8 + use crate::{CowStr, IntoStatic}; 9 9 use alloc::borrow::ToOwned; 10 10 use alloc::boxed::Box; 11 11 use alloc::collections::BTreeMap; ··· 15 15 use bytes::Bytes; 16 16 use core::any::TypeId; 17 17 use smol_str::SmolStr; 18 + use std::borrow::Cow; 18 19 19 20 /// Error used for converting from and into [`crate::types::value::Data`]. 20 21 #[derive(Clone, Debug, thiserror::Error, miette::Diagnostic)] ··· 134 135 } 135 136 } 136 137 137 - impl From<&str> for Data<'_> { 138 - fn from(t: &str) -> Self { 139 - Data::String(AtprotoStr::new_owned(t)) 138 + impl<'a> From<&'a str> for Data<'a> { 139 + fn from(t: &'a str) -> Self { 140 + Data::String(AtprotoStr::new(t)) 140 141 } 141 142 } 142 143 143 144 impl From<&[u8]> for Data<'_> { 144 145 fn from(t: &[u8]) -> Self { 145 146 Data::Bytes(Bytes::copy_from_slice(t)) 147 + } 148 + } 149 + 150 + impl<'s> From<CowStr<'s>> for Data<'s> { 151 + fn from(t: CowStr<'s>) -> Self { 152 + match t { 153 + CowStr::Borrowed(s) => Data::String(AtprotoStr::new(s)), 154 + CowStr::Owned(s) => Data::String(AtprotoStr::new_owned(s)), 155 + } 156 + } 157 + } 158 + 159 + impl From<SmolStr> for Data<'_> { 160 + fn from(t: SmolStr) -> Self { 161 + Data::String(AtprotoStr::new_owned(t)) 162 + } 163 + } 164 + 165 + impl<'s> From<Cow<'s, str>> for Data<'s> { 166 + fn from(t: Cow<'s, str>) -> Self { 167 + match t { 168 + Cow::Borrowed(s) => Data::String(AtprotoStr::new(s)), 169 + Cow::Owned(s) => Data::String(AtprotoStr::new_owned(s)), 170 + } 146 171 } 147 172 } 148 173
+1
crates/jacquard-derive/src/lib.rs
··· 148 148 //! } 149 149 //! ``` 150 150 151 + #![crate_type = "proc-macro"] 151 152 use proc_macro::TokenStream; 152 153 153 154 /// Attribute macro that adds an `extra_data` field to structs to capture unknown fields
-5
crates/jacquard-repo/src/lib.rs
··· 43 43 #![warn(clippy::all)] 44 44 #![deny(unsafe_code)] 45 45 46 - /// CAR (Content Addressable aRchive) utilities 47 46 pub mod car; 48 - /// Commit structures and signature verification 49 47 pub mod commit; 50 48 pub mod error; 51 - /// Merkle Search Tree implementation 52 49 pub mod mst; 53 - /// High-level repository operations 54 50 pub mod repo; 55 - /// Block storage abstraction 56 51 pub mod storage; 57 52 58 53 pub use error::{RepoError, RepoErrorKind, Result};
-2
crates/jacquard/src/lib.rs
··· 226 226 pub mod streaming; 227 227 228 228 #[cfg(feature = "api_bluesky")] 229 - /// Rich text utilities for Bluesky posts 230 229 pub mod richtext; 231 230 232 231 #[cfg(feature = "api")] 233 - /// Moderation decision making for labeled content 234 232 pub mod moderation; 235 233 236 234 pub use common::*;
+1
nix/modules/devshell.nix
··· 23 23 cargo-dist 24 24 cargo-nextest 25 25 zip 26 + atproto-goat 26 27 ]; 27 28 }; 28 29 apps = {