Struct ruma_identifiers::UserId [−][src]
pub struct UserId { /* fields omitted */ }Expand description
A Matrix user ID.
A UserId is generated randomly or converted from a string slice, and can be converted back
into a string as needed.
assert_eq!( UserId::try_from("@carl:example.com").unwrap().as_ref(), "@carl:example.com" );
Implementations
impl UserId[src]
impl UserId[src]pub fn new(server_name: &ServerName) -> Self[src]
This is supported on crate feature rand only.
pub fn new(server_name: &ServerName) -> Self[src]rand only.Attempts to generate a UserId for the given origin server with a localpart consisting of
12 random ASCII characters.
pub fn parse_with_server_name(
id: impl AsRef<str> + Into<Box<str>>,
server_name: &ServerName
) -> Result<Self, Error>[src]
pub fn parse_with_server_name(
id: impl AsRef<str> + Into<Box<str>>,
server_name: &ServerName
) -> Result<Self, Error>[src]Attempts to complete a user ID, by adding the colon + server name and @ prefix, if not
present already.
This is a convenience function for the login API, where a user can supply either their full
user ID or just the localpart. It only supports a valid user ID or a valid user ID
localpart, not the localpart plus the @ prefix, or the localpart plus server name without
the @ prefix.
impl UserId[src]
impl UserId[src]pub fn server_name(&self) -> &ServerName[src]
pub fn server_name(&self) -> &ServerName[src]Returns the server name of the user ID.
pub fn is_historical(&self) -> bool[src]
pub fn is_historical(&self) -> bool[src]Whether this user ID is a historical one, i.e. one that doesn’t conform to the latest specification of the user ID grammar but is still accepted because it was previously allowed.
Trait Implementations
impl<'de> Deserialize<'de> for UserId[src]
impl<'de> Deserialize<'de> for UserId[src]fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>, [src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>, [src]Deserialize this value from the given Serde deserializer. Read more
impl Ord for UserId[src]
impl Ord for UserId[src]impl PartialOrd<UserId> for UserId[src]
impl PartialOrd<UserId> for UserId[src]fn partial_cmp(&self, other: &Self) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>[src]This method returns an ordering between self and other values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl Eq for UserId[src]
Auto Trait Implementations
impl RefUnwindSafe for UserId
impl Send for UserId
impl Sync for UserId
impl Unpin for UserId
impl UnwindSafe for UserId
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>, pub fn vzip(self) -> V
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,