Skip to main content

Category

Struct Category 

Source
pub struct Category { /* private fields */ }
Expand description

One notification category the venture declares.

Categories are the vocabulary an account switches on and off, so they are the venture’s, not the module’s: booking, coach_notes, room_starting.

Implementations§

Source§

impl Category

Source

pub fn new(name: impl Into<String>) -> Self

A category that is on until the account says otherwise, and sends no badge count.

Source

pub fn default_enabled(self, enabled: bool) -> Self

Whether an account that has never expressed a preference gets this category (default true).

Source

pub fn badge(self, allowed: bool) -> Self

Whether a badge count may travel with this category’s notifications (default false).

Off by default because a badge number the server cannot compute correctly is worse than no badge: it is wrong on the device until the next push, and only the venture knows what it counts.

Source

pub fn in_app(self, keeps_a_row: bool) -> Self

Whether this category writes an in-app inbox row (default true).

Turn it off for a notification that is noise once it is past — “your room starts in ten minutes” is worth a push and worth nothing in a list read tomorrow. This is the venture’s decision about the category; the account’s own in_app switch is separate and is checked as well.

Source

pub fn email(self, sends_mail: bool) -> Self

Whether this category is emailed to an account with a verified address (default false).

Off by default because email is the most intrusive of the three channels and the hardest to take back — a venture opts a category in deliberately. The account’s own email switch is separate and is checked as well, and a category that is on here still sends nothing to an account with no verified address.

Source

pub fn subject_template(self, subject: impl Into<String>) -> Self

The subject line for this category’s mail. Defaults to the notification’s own title.

Source

pub fn render(self, mode: RenderMode) -> Self

Who renders this category’s strings for a device (default RenderMode::Server, issue #190).

Only ever consulted for a Message::Localizable: a caller that passes a rendered Notification gets exactly what it wrote, whatever this says.

RenderMode::Native and RenderMode::Both pass the caller’s Localizable::loc keys through to APNs and FCM, so an app that ships its own translations renders in the device’s language without the server knowing any of them. Web Push has no such mechanism, so a browser is always served the rendered text whatever the mode.

Source

pub fn name(&self) -> &str

The category’s name.

Trait Implementations§

Source§

impl Clone for Category

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Category

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Category

Source§

impl PartialEq for Category

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Category

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyEq for T
where T: Any + PartialEq,

Source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more