pub struct ContactId(u32);
Expand description
Contact ID, including reserved IDs.
Some contact IDs are reserved to identify special contacts. This type can represent both the special as well as normal contacts.
Tuple Fields§
§0: u32
Implementations§
source§impl ContactId
impl ContactId
sourcepub const UNDEFINED: ContactId = _
pub const UNDEFINED: ContactId = _
Undefined contact. Used as a placeholder for trashed messages.
sourcepub const SELF: ContactId = _
pub const SELF: ContactId = _
The owner of the account.
The email-address is set by set_config
using “addr”.
pub(crate) const LAST_SPECIAL: ContactId = _
sourcepub const DEVICE_ADDR: &'static str = "device@localhost"
pub const DEVICE_ADDR: &'static str = "device@localhost"
Address to go with ContactId::DEVICE
.
This is used by APIs which need to return an email address for this contact.
sourcepub fn is_special(&self) -> bool
pub fn is_special(&self) -> bool
Whether this is a special ContactId
.
Some ContactId
s are reserved for special contacts like ContactId::SELF
,
ContactId::INFO
and ContactId::DEVICE
. This function indicates whether this
ContactId
is any of the reserved special ContactId
s (true
) or whether it
is the ContactId
of a real contact (false
).
sourcepub const fn to_u32(&self) -> u32
pub const fn to_u32(&self) -> u32
Numerical representation of the ContactId
.
Each contact ID has a unique numerical representation which is used in the database
(via [rusqlite::ToSql
]) and also for FFI purposes. In Rust code you should never
need to use this directly.
sourcepub(crate) async fn mark_bot(
&self,
context: &Context,
is_bot: bool
) -> Result<()>
pub(crate) async fn mark_bot( &self, context: &Context, is_bot: bool ) -> Result<()>
Mark contact as bot.
sourcepub(crate) async fn regossip_keys(&self, context: &Context) -> Result<()>
pub(crate) async fn regossip_keys(&self, context: &Context) -> Result<()>
Reset gossip timestamp in all chats with this contact.
Trait Implementations§
source§impl<'de> Deserialize<'de> for ContactId
impl<'de> Deserialize<'de> for ContactId
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>,
source§impl FromSql for ContactId
impl FromSql for ContactId
Allow converting an SQLite integer directly into ContactId
.
source§fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self>
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self>
source§impl Ord for ContactId
impl Ord for ContactId
source§impl PartialEq for ContactId
impl PartialEq for ContactId
source§impl PartialOrd for ContactId
impl PartialOrd for ContactId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Copy for ContactId
impl Eq for ContactId
impl StructuralPartialEq for ContactId
Auto Trait Implementations§
impl RefUnwindSafe for ContactId
impl Send for ContactId
impl Sync for ContactId
impl Unpin for ContactId
impl UnwindSafe for ContactId
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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
§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.