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.
Sourcepub fn retire_community_pins(&mut self)
pub fn retire_community_pins(&mut self)
Drop the Community pins older builds wrote. Communities are arranged on the rail now, so a pin there means nothing; it is shed on the next write rather than by a write of its own. Keyed on FORM (a community id is 64 hex, a DM is an npub), so a pin for a chat this device has never synced still survives.
Trait Implementations§
Source§impl Clone for PinnedChats
impl Clone for PinnedChats
Source§impl Debug for PinnedChats
impl Debug for PinnedChats
Source§impl Default for PinnedChats
impl Default for PinnedChats
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>,
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
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
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> ⓘ
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> ⓘ
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