pub struct PinnedChats {
pub v: u32,
pub chats: Vec<String>,
}Expand description
The synced list. v is a forward-compat marker, not a gate: an unknown
version still round-trips its ids rather than being discarded.
Fields§
§v: u32§chats: Vec<String>Ordered ids. Order IS the display order.
Implementations§
Source§impl PinnedChats
impl PinnedChats
Sourcepub fn from_json(s: &str) -> Self
pub fn from_json(s: &str) -> Self
Tolerant parse: a malformed payload degrades to an empty list, never an error that aborts a sync.
pub fn to_json(&self) -> String
pub fn contains(&self, id: &str) -> bool
Sourcepub fn pin(&mut self, id: &str, max: usize) -> Result<(), String>
pub fn pin(&mut self, id: &str, max: usize) -> Result<(), String>
Append id if absent, up to max. Err when the cap is already met —
the caller is a user action, so a refusal is a message, not a silent
no-op. max is passed rather than read so this stays pure and testable;
callers use effective_max_pinned.
Trait Implementations§
Source§impl Clone for PinnedChats
impl Clone for PinnedChats
Source§fn clone(&self) -> PinnedChats
fn clone(&self) -> PinnedChats
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PinnedChats
impl Debug for PinnedChats
Source§impl Default for PinnedChats
impl Default for PinnedChats
Source§fn default() -> PinnedChats
fn default() -> PinnedChats
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PinnedChats
impl<'de> Deserialize<'de> for PinnedChats
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for PinnedChats
Source§impl PartialEq for PinnedChats
impl PartialEq for PinnedChats
Source§impl Serialize for PinnedChats
impl Serialize for PinnedChats
impl StructuralPartialEq for PinnedChats
Auto Trait Implementations§
impl Freeze for PinnedChats
impl RefUnwindSafe for PinnedChats
impl Send for PinnedChats
impl Sync for PinnedChats
impl Unpin for PinnedChats
impl UnsafeUnpin for PinnedChats
impl UnwindSafe for PinnedChats
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more