// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.sync.defs // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. //! Generated bindings for the `com.atproto.sync` Lexicon namespace/module. pub mod get_blob; pub mod get_blocks; pub mod get_checkout; pub mod get_head; pub mod get_host_status; pub mod get_latest_commit; pub mod get_record; pub mod get_repo; pub mod get_repo_status; pub mod list_blobs; pub mod list_hosts; pub mod list_repos; pub mod list_repos_by_collection; pub mod notify_of_update; pub mod request_crawl; #[cfg(feature = "streaming")] pub mod subscribe_repos; use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr}; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum HostStatus { Active, Idle, Offline, Throttled, Banned, Other(S), } impl HostStatus { pub fn as_str(&self) -> &str { match self { Self::Active => "active", Self::Idle => "idle", Self::Offline => "offline", Self::Throttled => "throttled", Self::Banned => "banned", Self::Other(s) => s.as_ref(), } } /// Construct from a string-like value, matching known values. pub fn from_value(s: S) -> Self { match s.as_ref() { "active" => Self::Active, "idle" => Self::Idle, "offline" => Self::Offline, "throttled" => Self::Throttled, "banned" => Self::Banned, _ => Self::Other(s), } } } impl AsRef for HostStatus { fn as_ref(&self) -> &str { self.as_str() } } impl core::fmt::Display for HostStatus { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl serde::Serialize for HostStatus { fn serialize(&self, serializer: Ser) -> Result where Ser: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, S: serde::Deserialize<'de> + BosStr> serde::Deserialize<'de> for HostStatus { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = S::deserialize(deserializer)?; Ok(Self::from_value(s)) } } impl jacquard_common::IntoStatic for HostStatus where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr, { type Output = HostStatus; fn into_static(self) -> Self::Output { match self { HostStatus::Active => HostStatus::Active, HostStatus::Idle => HostStatus::Idle, HostStatus::Offline => HostStatus::Offline, HostStatus::Throttled => HostStatus::Throttled, HostStatus::Banned => HostStatus::Banned, HostStatus::Other(v) => HostStatus::Other(v.into_static()), } } }