zulip-api 0.0.8

Client library for interacting with the Zulip API
Documentation
use zeroize::Zeroize;

/// Represents a Zulip API user used to authenticate to the service.
#[derive(Clone, Debug, Eq, PartialEq, Zeroize)]
pub struct User(String);

impl User {
    /// Creates a new [User].
    pub const fn new() -> Self {
        Self(String::new())
    }

    /// Gets the string representation of the [User].
    pub fn as_str(&self) -> &str {
        self.0.as_str()
    }
}

impl Default for User {
    fn default() -> Self {
        Self::new()
    }
}

impl From<&str> for User {
    fn from(val: &str) -> Self {
        Self(val.into())
    }
}

impl From<String> for User {
    fn from(val: String) -> Self {
        Self(val)
    }
}