A better Rust ATProto crate
at lifetimes 3.1 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: com.atproto.label.subscribeLabels 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8#[jacquard_derive::lexicon] 9#[derive( 10 serde::Serialize, 11 serde::Deserialize, 12 Debug, 13 Clone, 14 PartialEq, 15 Eq, 16 jacquard_derive::IntoStatic 17)] 18#[serde(rename_all = "camelCase")] 19pub struct Info<'a> { 20 #[serde(skip_serializing_if = "std::option::Option::is_none")] 21 #[serde(borrow)] 22 pub message: std::option::Option<jacquard_common::CowStr<'a>>, 23 #[serde(borrow)] 24 pub name: jacquard_common::CowStr<'a>, 25} 26 27#[jacquard_derive::lexicon] 28#[derive( 29 serde::Serialize, 30 serde::Deserialize, 31 Debug, 32 Clone, 33 PartialEq, 34 Eq, 35 jacquard_derive::IntoStatic 36)] 37#[serde(rename_all = "camelCase")] 38pub struct Labels<'a> { 39 #[serde(borrow)] 40 pub labels: Vec<crate::com_atproto::label::Label<'a>>, 41 pub seq: i64, 42} 43 44#[derive( 45 serde::Serialize, 46 serde::Deserialize, 47 Debug, 48 Clone, 49 PartialEq, 50 Eq, 51 bon::Builder, 52 jacquard_derive::IntoStatic 53)] 54#[builder(start_fn = new)] 55#[serde(rename_all = "camelCase")] 56pub struct SubscribeLabels { 57 #[serde(skip_serializing_if = "std::option::Option::is_none")] 58 pub cursor: std::option::Option<i64>, 59} 60 61#[jacquard_derive::open_union] 62#[derive( 63 serde::Serialize, 64 serde::Deserialize, 65 Debug, 66 Clone, 67 PartialEq, 68 Eq, 69 jacquard_derive::IntoStatic 70)] 71#[serde(tag = "$type")] 72#[serde(bound(deserialize = "'de: 'a"))] 73pub enum SubscribeLabelsMessage<'a> { 74 #[serde(rename = "#labels")] 75 Labels(Box<jacquard_common::types::value::Data<'a>>), 76 #[serde(rename = "#info")] 77 Info(Box<jacquard_common::types::value::Data<'a>>), 78} 79 80#[jacquard_derive::open_union] 81#[derive( 82 serde::Serialize, 83 serde::Deserialize, 84 Debug, 85 Clone, 86 PartialEq, 87 Eq, 88 thiserror::Error, 89 miette::Diagnostic 90)] 91#[serde(tag = "error", content = "message")] 92#[serde(bound(deserialize = "'de: 'a"))] 93pub enum SubscribeLabelsError<'a> { 94 #[serde(rename = "FutureCursor")] 95 FutureCursor(std::option::Option<String>), 96} 97 98impl std::fmt::Display for SubscribeLabelsError<'_> { 99 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 100 match self { 101 Self::FutureCursor(msg) => { 102 write!(f, "FutureCursor")?; 103 if let Some(msg) = msg { 104 write!(f, ": {}", msg)?; 105 } 106 Ok(()) 107 } 108 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 109 } 110 } 111} 112 113impl jacquard_common::IntoStatic for SubscribeLabelsError<'_> { 114 type Output = SubscribeLabelsError<'static>; 115 fn into_static(self) -> Self::Output { 116 match self { 117 SubscribeLabelsError::FutureCursor(v) => { 118 SubscribeLabelsError::FutureCursor(v.into_static()) 119 } 120 SubscribeLabelsError::Unknown(v) => { 121 SubscribeLabelsError::Unknown(v.into_static()) 122 } 123 } 124 } 125}