pub enum AlertClass {
SyncStale,
RecoveryCheckDue,
QuotaSoft,
QuotaGraceExpiring,
QuarantinePending,
DropPending,
}Expand description
Every alert Capsule can raise. A closed enum: an unknown wire value is a structural
error, like every other closed enum in the schema rules — which is what the serde derive
without #[serde(other)] gives.
The variant order is the delivery order super::evaluate() emits in, and matches the
SSoT’s own table so a reader can diff the two.
Ord is derived because the suppression map (super::NotifyInput::suppressed) is keyed on
this type and must iterate deterministically.
Variants§
SyncStale
Two weeks without a completed sync while changes remain un-synced. Trigger owner: Sync — Notifications.
RecoveryCheckDue
A recovery-secret verification check is due. Trigger owner: Backup — Schedule and Triggers.
QuotaSoft
Storage crossed the soft limit and is below the hard limit. Trigger owner: Quota — Thresholds and States.
QuotaGraceExpiring
Storage is over the hard limit — the grace window is counting, or has closed. Trigger owner: Quota — Thresholds and States.
QuarantinePending
Items are sitting on a quarantine surface awaiting a human. Trigger owner: Threat Model — Quarantine Surfaces.
DropPending
Guest drops are awaiting review and adoption. Trigger owner: Web Upload — Drop and Adoption Lifecycle.
Implementations§
Source§impl AlertClass
impl AlertClass
Sourcepub const ALL: [Self; 6]
pub const ALL: [Self; 6]
Every class, in delivery order. Iterating this rather than a hand-written list is what makes “the enum is closed” a property a reader can check: adding a variant without extending this array fails to compile, because the array’s length is declared.
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
The stable wire name — identical to the serde representation, so a log line, a
Alert::params value, and the serialized form never disagree.
Sourcepub fn from_wire(name: &str) -> Option<Self>
pub fn from_wire(name: &str) -> Option<Self>
The inverse of as_str: parse a wire name, rejecting anything that is
not one of the six.
The enum is closed, so an unrecognized name is None — a structural error for the
caller to report, never a class that is silently dropped. This exists so a boundary that
carries the name as a plain string (the app FFI’s suppression map, a persisted
client preference) has one table to parse against rather than its own copy.
Sourcepub const fn severity(self) -> AlertSeverity
pub const fn severity(self) -> AlertSeverity
How loudly a client should present this class. A property of the class, not of the
instant it fired, so it lives here rather than being decided per-Alert.
Sourcepub const fn pre_armable(self) -> bool
pub const fn pre_armable(self) -> bool
Whether this class’s trigger is a deadline the device can compute alone, and can therefore be pre-armed as a scheduled local notification.
false for the three server-state classes (quota_*, quarantine_pending,
drop_pending): their condition lives on the server, so on a device that never runs
they cannot fire at all. That gap is real and v1 accepts it — those three surface at
next app launch. Closing it is what the post-v1 wake tier is for.
Trait Implementations§
Source§impl Clone for AlertClass
impl Clone for AlertClass
Source§fn clone(&self) -> AlertClass
fn clone(&self) -> AlertClass
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for AlertClass
Source§impl Debug for AlertClass
impl Debug for AlertClass
Source§impl<'de> Deserialize<'de> for AlertClass
impl<'de> Deserialize<'de> for AlertClass
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 AlertClass
Source§impl Hash for AlertClass
impl Hash for AlertClass
Source§impl Ord for AlertClass
impl Ord for AlertClass
Source§fn cmp(&self, other: &AlertClass) -> Ordering
fn cmp(&self, other: &AlertClass) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for AlertClass
impl PartialEq for AlertClass
Source§fn eq(&self, other: &AlertClass) -> bool
fn eq(&self, other: &AlertClass) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for AlertClass
impl PartialOrd for AlertClass
Source§impl Serialize for AlertClass
impl Serialize for AlertClass
impl StructuralPartialEq for AlertClass
Auto Trait Implementations§
impl Freeze for AlertClass
impl RefUnwindSafe for AlertClass
impl Send for AlertClass
impl Sync for AlertClass
impl Unpin for AlertClass
impl UnsafeUnpin for AlertClass
impl UnwindSafe for AlertClass
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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