pub struct ProtocolAddress { /* private fields */ }Expand description
Represents a unique Signal client instance as (<user ID>, <device ID>) pair.
Implementations§
Source§impl ProtocolAddress
impl ProtocolAddress
Sourcepub fn new(name: String, device_id: DeviceId) -> ProtocolAddress
pub fn new(name: String, device_id: DeviceId) -> ProtocolAddress
Create a new address.
namedefines 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.try_into().unwrap();
let address = ProtocolAddress::new(user_id.clone(), device_id);
assert!(address.name() == &user_id);
assert!(address.device_id() == device_id);Sourcepub 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§
Source§impl Clone for ProtocolAddress
impl Clone for ProtocolAddress
Source§fn clone(&self) -> ProtocolAddress
fn clone(&self) -> ProtocolAddress
Returns a duplicate 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 moreSource§impl Debug for ProtocolAddress
impl Debug for ProtocolAddress
Source§impl Display for ProtocolAddress
impl Display for ProtocolAddress
Source§impl Hash for ProtocolAddress
impl Hash for ProtocolAddress
Source§impl Ord for ProtocolAddress
impl Ord for ProtocolAddress
Source§fn cmp(&self, other: &ProtocolAddress) -> Ordering
fn cmp(&self, other: &ProtocolAddress) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ProtocolAddress
impl PartialEq for ProtocolAddress
Source§impl PartialOrd for ProtocolAddress
impl PartialOrd for ProtocolAddress
impl 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§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§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