Struct libsignal_protocol::ProtocolAddress
pub struct ProtocolAddress { /* private fields */ }
Expand description
Represents a unique Signal client instance as (<user ID>, <device ID>)
pair.
Implementations§
§impl ProtocolAddress
impl ProtocolAddress
pub fn new(name: String, device_id: DeviceId) -> ProtocolAddress
pub fn new(name: String, device_id: DeviceId) -> ProtocolAddress
Create a new address.
name
defines a user’s public identity, and therefore must be globally unique to that user.- Each Signal client instance then has its own
device_id
, which must be unique among all clients for that user.
use libsignal_core::{DeviceId, ProtocolAddress};
// This is a unique id for some user, typically a UUID.
let user_id: String = "04899A85-4C9E-44CC-8428-A02AB69335F1".to_string();
// Each client instance representing that user has a unique device id.
let device_id: DeviceId = 2_u32.into();
let address = ProtocolAddress::new(user_id.clone(), device_id);
assert!(address.name() == &user_id);
assert!(address.device_id() == device_id);
pub fn device_id(&self) -> DeviceId
pub fn device_id(&self) -> DeviceId
An identifier representing a particular Signal client instance to send to.
For example, if a user has set up Signal on both their phone and laptop, a particular message sent to the user will still only go to a single device. So when a user sends a message to another user at all, they’re actually sending a message to every device.
Trait Implementations§
§impl Clone for ProtocolAddress
impl Clone for ProtocolAddress
§fn clone(&self) -> ProtocolAddress
fn clone(&self) -> ProtocolAddress
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for ProtocolAddress
impl Debug for ProtocolAddress
§impl Display for ProtocolAddress
impl Display for ProtocolAddress
§impl Hash for ProtocolAddress
impl Hash for ProtocolAddress
§impl Ord for ProtocolAddress
impl Ord for ProtocolAddress
§impl PartialEq for ProtocolAddress
impl PartialEq for ProtocolAddress
§fn eq(&self, other: &ProtocolAddress) -> bool
fn eq(&self, other: &ProtocolAddress) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.§impl PartialOrd for ProtocolAddress
impl PartialOrd for ProtocolAddress
§fn partial_cmp(&self, other: &ProtocolAddress) -> Option<Ordering>
fn partial_cmp(&self, other: &ProtocolAddress) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for ProtocolAddress
impl StructuralPartialEq for ProtocolAddress
Auto Trait Implementations§
impl Freeze for ProtocolAddress
impl RefUnwindSafe for ProtocolAddress
impl Send for ProtocolAddress
impl Sync for ProtocolAddress
impl Unpin for ProtocolAddress
impl UnwindSafe for ProtocolAddress
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
key
and return true
if they are equal.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