Something went wrong. Try again.
atproto Thingiverse but good
Something went wrong. Try again.
3.1 kB · 113 lines
Rust
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113// @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<S: BosStr = DefaultStr> { Active, Idle, Offline, Throttled, Banned, Other(S),}
impl<S: BosStr> HostStatus<S> { 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<S: BosStr> AsRef<str> for HostStatus<S> { fn as_ref(&self) -> &str { self.as_str() }}
impl<S: BosStr> core::fmt::Display for HostStatus<S> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) }}
impl<S: BosStr> serde::Serialize for HostStatus<S> { fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error> where Ser: serde::Serializer, { serializer.serialize_str(self.as_str()) }}
impl<'de, S: serde::Deserialize<'de> + BosStr> serde::Deserialize<'de>for HostStatus<S> { fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de>, { let s = S::deserialize(deserializer)?; Ok(Self::from_value(s)) }}
impl<S: BosStr> jacquard_common::IntoStatic for HostStatus<S>where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr,{ type Output = HostStatus<S::Output>; 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()), } }}