#[non_exhaustive]pub struct Recipient { /* private fields */ }Expand description
Who a notification goes to: a user, addresses for someone without an account, or a user with an extra address.
Implementations§
Source§impl Recipient
impl Recipient
Sourcepub fn for_user(user: &User) -> Self
pub fn for_user(user: &User) -> Self
The user, at their email address (and any addresses added with and).
Sourcepub fn to(channel: &str, address: impl Into<String>) -> Self
pub fn to(channel: &str, address: impl Into<String>) -> Self
Someone without an account: Recipient::to("mail", "a@b.c").
Sourcepub fn and(self, channel: &str, address: impl Into<String>) -> Self
pub fn and(self, channel: &str, address: impl Into<String>) -> Self
Adds (or replaces) the address for channel.
Sourcepub fn address(&self, channel: &str) -> Option<String>
pub fn address(&self, channel: &str) -> Option<String>
The address for channel; for mail, the user’s email when no
other address was given.
Sourcepub fn email(&self) -> Option<String>
pub fn email(&self) -> Option<String>
The address for the mail channel (see Recipient::address).
Sourcepub fn in_locale(self, locale: impl Into<String>) -> Self
pub fn in_locale(self, locale: impl Into<String>) -> Self
Writes to this recipient in locale (e.g. "es").
Sourcepub fn locale(&self) -> Option<String>
pub fn locale(&self) -> Option<String>
The recipient’s language: the one given with Recipient::in_locale,
else the user’s locale column if the users table has one.
Notifications build their messages in it (t() in mail views,
state.current_lang() in code).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Recipient
impl<'de> Deserialize<'de> for Recipient
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
Auto Trait Implementations§
impl Freeze for Recipient
impl RefUnwindSafe for Recipient
impl Send for Recipient
impl Sync for Recipient
impl Unpin for Recipient
impl UnsafeUnpin for Recipient
impl UnwindSafe for Recipient
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
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<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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