A library for ATProtocol identities.

refactor: Debug derive cleanup

Signed-off-by: Nick Gerakines <nick.gerakines@gmail.com>

+1 -1
Cargo.toml
··· 14 14 15 15 [workspace.package] 16 16 edition = "2024" 17 - rust-version = "1.87" 17 + rust-version = "1.89" 18 18 repository = "https://tangled.sh/@smokesignal.events/atproto-identity-rs" 19 19 authors = ["Nick Gerakines <nick.gerakines@gmail.com>"] 20 20 license = "MIT"
+2 -2
crates/atproto-oauth/src/encoding.rs
··· 11 11 /// Trait for converting types to base64-encoded JSON. 12 12 pub trait ToBase64 { 13 13 /// Convert the type to a base64-encoded JSON string. 14 - fn to_base64(&self) -> Result<Cow<str>>; 14 + fn to_base64(&self) -> Result<Cow<'_, str>>; 15 15 } 16 16 17 17 impl<T: Serialize> ToBase64 for T { 18 - fn to_base64(&self) -> Result<Cow<str>> { 18 + fn to_base64(&self) -> Result<Cow<'_, str>> { 19 19 let json_bytes = serde_json::to_vec(&self)?; 20 20 let encoded_json_bytes = general_purpose::URL_SAFE_NO_PAD.encode(json_bytes); 21 21 Ok(Cow::Owned(encoded_json_bytes))
+2 -1
crates/atproto-record/src/lexicon/com_atproto_repo.rs
··· 34 34 /// // Use TypedStrongRef for automatic $type field handling 35 35 /// let typed_ref = TypedStrongRef::new(strong_ref); 36 36 /// ``` 37 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] 37 + #[derive(Serialize, Deserialize, PartialEq, Clone)] 38 + #[cfg_attr(debug_assertions, derive(Debug))] 38 39 pub struct StrongRef { 39 40 /// AT URI pointing to a specific record 40 41 /// Format: at://[did]/[collection]/[rkey]
+4 -2
crates/atproto-record/src/lexicon/community_lexicon_attestation.rs
··· 37 37 /// // Referenced signature 38 38 /// let reference = SignatureOrRef::Reference(typed_strong_ref); 39 39 /// ``` 40 - #[derive(Debug, Deserialize, Serialize, Clone, PartialEq)] 40 + #[derive(Deserialize, Serialize, Clone, PartialEq)] 41 + #[cfg_attr(debug_assertions, derive(Debug))] 41 42 #[serde(untagged)] 42 43 pub enum SignatureOrRef { 43 44 /// A reference to a signature stored elsewhere ··· 77 78 /// extra: HashMap::new(), 78 79 /// }; 79 80 /// ``` 80 - #[derive(Debug, Deserialize, Serialize, Clone, PartialEq)] 81 + #[derive(Deserialize, Serialize, Clone, PartialEq)] 82 + #[cfg_attr(debug_assertions, derive(Debug))] 81 83 pub struct Signature { 82 84 /// DID of the entity that created this signature 83 85 pub issuer: String,
+6 -2
crates/atproto-record/src/lexicon/community_lexicon_badge.rs
··· 39 39 /// 40 40 /// let typed_badge = TypedDefinition::new(badge); 41 41 /// ``` 42 - #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] 42 + #[derive(Serialize, Deserialize, Clone, PartialEq)] 43 + #[cfg_attr(debug_assertions, derive(Debug))] 43 44 pub struct Definition { 44 45 /// Name of the badge 45 46 pub name: String, ··· 62 63 } 63 64 64 65 /// Type alias for Definition with automatic $type field handling 66 + #[allow(dead_code)] 65 67 pub type TypedDefinition = TypedLexicon<Definition>; 66 68 67 69 /// Badge award structure. ··· 91 93 /// 92 94 /// let typed_award = TypedAward::new(award); 93 95 /// ``` 94 - #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] 96 + #[derive(Serialize, Deserialize, Clone, PartialEq)] 97 + #[cfg_attr(debug_assertions, derive(Debug))] 95 98 pub struct Award { 96 99 /// Reference to the badge definition being awarded 97 100 pub badge: TypedStrongRef, ··· 116 119 } 117 120 118 121 /// Type alias for Award with automatic $type field handling 122 + #[allow(dead_code)] 119 123 pub type TypedAward = TypedLexicon<Award>; 120 124 121 125 #[cfg(test)]
+17 -8
crates/atproto-record/src/lexicon/community_lexicon_calendar_event.rs
··· 10 10 11 11 use crate::datetime::format as datetime_format; 12 12 use crate::datetime::optional_format as optional_datetime_format; 13 + use crate::lexicon::TypedBlob; 13 14 use crate::lexicon::community::lexicon::location::Locations; 14 - use crate::lexicon::{Blob, TypedBlob}; 15 15 use crate::typed::{LexiconType, TypedLexicon}; 16 16 17 17 /// The namespace identifier for events ··· 20 20 /// Event status enumeration. 21 21 /// 22 22 /// Represents the current status of a calendar event. 23 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Default)] 23 + #[derive(Serialize, Deserialize, PartialEq, Clone, Default)] 24 + #[cfg_attr(debug_assertions, derive(Debug))] 24 25 pub enum Status { 25 26 /// Event is scheduled and confirmed 26 27 #[default] ··· 47 48 /// Event mode enumeration. 48 49 /// 49 50 /// Represents how attendees can participate in the event. 50 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Default)] 51 + #[derive(Serialize, Deserialize, PartialEq, Clone, Default)] 52 + #[cfg_attr(debug_assertions, derive(Debug))] 51 53 pub enum Mode { 52 54 /// In-person attendance only 53 55 #[default] ··· 70 72 /// 71 73 /// Represents a URI with an optional human-readable name. 72 74 /// Used for linking to external resources related to an event. 73 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] 75 + #[derive(Serialize, Deserialize, PartialEq, Clone)] 76 + #[cfg_attr(debug_assertions, derive(Debug))] 74 77 pub struct NamedUri { 75 78 /// The URI/URL 76 79 pub uri: String, ··· 96 99 /// 97 100 /// Similar to NamedUri but kept as a separate type for semantic clarity 98 101 /// and type safety when dealing with event-specific links. 99 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] 102 + #[derive(Serialize, Deserialize, PartialEq, Clone)] 103 + #[cfg_attr(debug_assertions, derive(Debug))] 100 104 pub struct EventLink { 101 105 /// The URI/URL for the event link 102 106 pub uri: String, ··· 121 125 /// Aspect ratio for media content. 122 126 /// 123 127 /// Represents the width-to-height ratio of visual media. 124 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] 128 + #[derive(Serialize, Deserialize, PartialEq, Clone)] 129 + #[cfg_attr(debug_assertions, derive(Debug))] 125 130 pub struct AspectRatio { 126 131 /// Width component of the ratio 127 132 pub width: u64, ··· 135 140 /// Media structure for event-related visual content. 136 141 /// 137 142 /// Represents images, videos, or other media associated with an event. 138 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] 143 + #[derive(Serialize, Deserialize, PartialEq, Clone)] 144 + #[cfg_attr(debug_assertions, derive(Debug))] 139 145 pub struct Media { 140 146 /// The media content as a blob reference 141 147 pub content: TypedBlob, ··· 191 197 /// 192 198 /// let typed_event = TypedEvent::new(event); 193 199 /// ``` 194 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] 200 + #[derive(Serialize, Deserialize, PartialEq, Clone)] 201 + #[cfg_attr(debug_assertions, derive(Debug))] 195 202 pub struct Event { 196 203 /// Name/title of the event 197 204 pub name: String, ··· 262 269 263 270 #[cfg(test)] 264 271 mod tests { 272 + use crate::lexicon::Blob; 273 + 265 274 use super::*; 266 275 use anyhow::Result; 267 276
+4 -2
crates/atproto-record/src/lexicon/community_lexicon_calendar_rsvp.rs
··· 18 18 /// RSVP status enumeration. 19 19 /// 20 20 /// Represents the response status for an event invitation. 21 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Default)] 21 + #[derive(Serialize, Deserialize, PartialEq, Clone, Default)] 22 + #[cfg_attr(debug_assertions, derive(Debug))] 22 23 pub enum RsvpStatus { 23 24 /// Attendee is planning to attend 24 25 #[default] ··· 61 62 /// // Use TypedRsvp for automatic $type field handling 62 63 /// let typed_rsvp = TypedRsvp::new(rsvp); 63 64 /// ``` 64 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] 65 + #[derive(Serialize, Deserialize, PartialEq, Clone)] 66 + #[cfg_attr(debug_assertions, derive(Debug))] 65 67 pub struct Rsvp { 66 68 /// Reference to the event being responded to 67 69 pub subject: StrongRef,
+10 -5
crates/atproto-record/src/lexicon/community_lexicon_location.rs
··· 43 43 /// }; 44 44 /// let location = LocationOrRef::InlineAddress(TypedAddress::new(address)); 45 45 /// ``` 46 - #[derive(Debug, Deserialize, Serialize, Clone, PartialEq)] 46 + #[derive(Deserialize, Serialize, Clone, PartialEq)] 47 + #[cfg_attr(debug_assertions, derive(Debug))] 47 48 #[serde(untagged)] 48 49 pub enum LocationOrRef { 49 50 /// A reference to a location stored elsewhere ··· 83 84 /// name: Some("Tech Hub Building".to_string()), 84 85 /// }; 85 86 /// ``` 86 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] 87 + #[derive(Serialize, Deserialize, PartialEq, Clone)] 88 + #[cfg_attr(debug_assertions, derive(Debug))] 87 89 pub struct Address { 88 90 /// Country name (required) 89 91 pub country: String, ··· 138 140 /// name: Some("San Francisco".to_string()), 139 141 /// }; 140 142 /// ``` 141 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] 143 + #[derive(Serialize, Deserialize, PartialEq, Clone)] 144 + #[cfg_attr(debug_assertions, derive(Debug))] 142 145 pub struct Geo { 143 146 /// Latitude coordinate as a string 144 147 pub latitude: String, ··· 175 178 /// name: Some("Empire State Building".to_string()), 176 179 /// }; 177 180 /// ``` 178 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] 181 + #[derive(Serialize, Deserialize, PartialEq, Clone)] 182 + #[cfg_attr(debug_assertions, derive(Debug))] 179 183 pub struct Fsq { 180 184 /// Foursquare place identifier 181 185 pub fsq_place_id: String, ··· 209 213 /// name: Some("Downtown Area".to_string()), 210 214 /// }; 211 215 /// ``` 212 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] 216 + #[derive(Serialize, Deserialize, PartialEq, Clone)] 217 + #[cfg_attr(debug_assertions, derive(Debug))] 213 218 pub struct Hthree { 214 219 /// H3 hexagon identifier 215 220 pub value: String,
+6 -3
crates/atproto-record/src/lexicon/primatives.rs
··· 33 33 /// // Use TypedBlob for automatic $type field handling 34 34 /// let typed_blob = TypedBlob::new(blob); 35 35 /// ``` 36 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] 36 + #[derive(Serialize, Deserialize, PartialEq, Clone)] 37 + #[cfg_attr(debug_assertions, derive(Debug))] 37 38 pub struct Blob { 38 39 /// Link to the blob content via CID 39 40 #[serde(rename = "ref")] ··· 61 62 /// 62 63 /// Represents a content-addressed link using a CID (Content Identifier). 63 64 /// This is used to reference immutable content in the AT Protocol network. 64 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] 65 + #[derive(Serialize, Deserialize, PartialEq, Clone)] 66 + #[cfg_attr(debug_assertions, derive(Debug))] 65 67 pub struct Link { 66 68 /// The CID (Content Identifier) as a string 67 69 #[serde(rename = "$link")] ··· 82 84 /// }; 83 85 /// // Serializes to: {"$bytes": "c2lnbmF0dXJlIGRhdGE="} 84 86 /// ``` 85 - #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] 87 + #[derive(Serialize, Deserialize, PartialEq, Clone)] 88 + #[cfg_attr(debug_assertions, derive(Debug))] 86 89 pub struct Bytes { 87 90 /// The raw bytes, serialized as base64 in JSON 88 91 #[serde(rename = "$bytes", with = "bytes_format")]