Struct ruma::ClientSecret
source · pub struct ClientSecret(/* private fields */);
Expand description
A client secret.
Client secrets in Matrix are opaque character sequences of [0-9a-zA-Z.=_-]
. Their length must
must not exceed 255 characters.
You can create one from a string (using ClientSecret::parse()
) but the recommended way is to
use ClientSecret::new()
to generate a random one. If that function is not available for you,
you need to activate this crate’s rand
Cargo feature.
Implementations§
source§impl ClientSecret
impl ClientSecret
source§impl ClientSecret
impl ClientSecret
sourcepub fn parse(s: impl AsRef<str>) -> Result<OwnedClientSecret, Error>
pub fn parse(s: impl AsRef<str>) -> Result<OwnedClientSecret, Error>
Try parsing a &str
into an OwnedClientSecret
.
The same can also be done using FromStr
, TryFrom
or TryInto
.
This function is simply more constrained and thus useful in generic contexts.
sourcepub fn parse_box(
s: impl AsRef<str> + Into<Box<str>>,
) -> Result<Box<ClientSecret>, Error>
pub fn parse_box( s: impl AsRef<str> + Into<Box<str>>, ) -> Result<Box<ClientSecret>, Error>
Try parsing a &str
into a Box<ClientSecret>
.
The same can also be done using FromStr
, TryFrom
or TryInto
.
This function is simply more constrained and thus useful in generic contexts.
source§impl ClientSecret
impl ClientSecret
sourcepub fn new() -> OwnedClientSecret
pub fn new() -> OwnedClientSecret
Creates a random client secret.
This will currently be a UUID without hyphens, but no guarantees are made about the structure of client secrets generated from this function.
Trait Implementations§
source§impl AsRef<[u8]> for ClientSecret
impl AsRef<[u8]> for ClientSecret
source§impl AsRef<ClientSecret> for ClientSecret
impl AsRef<ClientSecret> for ClientSecret
source§fn as_ref(&self) -> &ClientSecret
fn as_ref(&self) -> &ClientSecret
source§impl AsRef<ClientSecret> for OwnedClientSecret
impl AsRef<ClientSecret> for OwnedClientSecret
source§fn as_ref(&self) -> &ClientSecret
fn as_ref(&self) -> &ClientSecret
source§impl AsRef<str> for ClientSecret
impl AsRef<str> for ClientSecret
source§impl Borrow<ClientSecret> for OwnedClientSecret
impl Borrow<ClientSecret> for OwnedClientSecret
source§fn borrow(&self) -> &ClientSecret
fn borrow(&self) -> &ClientSecret
source§impl Clone for Box<ClientSecret>
impl Clone for Box<ClientSecret>
source§impl Debug for ClientSecret
impl Debug for ClientSecret
source§impl<'de> Deserialize<'de> for Box<ClientSecret>
impl<'de> Deserialize<'de> for Box<ClientSecret>
source§fn deserialize<D>(
deserializer: D,
) -> Result<Box<ClientSecret>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Box<ClientSecret>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
source§impl Display for ClientSecret
impl Display for ClientSecret
source§impl From<&ClientSecret> for Arc<ClientSecret>
impl From<&ClientSecret> for Arc<ClientSecret>
source§fn from(s: &ClientSecret) -> Arc<ClientSecret>
fn from(s: &ClientSecret) -> Arc<ClientSecret>
source§impl From<&ClientSecret> for Box<ClientSecret>
impl From<&ClientSecret> for Box<ClientSecret>
source§fn from(id: &ClientSecret) -> Box<ClientSecret>
fn from(id: &ClientSecret) -> Box<ClientSecret>
source§impl From<&ClientSecret> for OwnedClientSecret
impl From<&ClientSecret> for OwnedClientSecret
source§fn from(id: &ClientSecret) -> OwnedClientSecret
fn from(id: &ClientSecret) -> OwnedClientSecret
source§impl From<&ClientSecret> for Rc<ClientSecret>
impl From<&ClientSecret> for Rc<ClientSecret>
source§fn from(s: &ClientSecret) -> Rc<ClientSecret>
fn from(s: &ClientSecret) -> Rc<ClientSecret>
source§impl From<&ClientSecret> for String
impl From<&ClientSecret> for String
source§fn from(id: &ClientSecret) -> String
fn from(id: &ClientSecret) -> String
source§impl From<OwnedClientSecret> for Box<ClientSecret>
impl From<OwnedClientSecret> for Box<ClientSecret>
source§fn from(a: OwnedClientSecret) -> Box<ClientSecret>
fn from(a: OwnedClientSecret) -> Box<ClientSecret>
source§impl Hash for ClientSecret
impl Hash for ClientSecret
source§impl Ord for ClientSecret
impl Ord for ClientSecret
source§impl PartialEq<&ClientSecret> for OwnedClientSecret
impl PartialEq<&ClientSecret> for OwnedClientSecret
source§fn eq(&self, other: &&ClientSecret) -> bool
fn eq(&self, other: &&ClientSecret) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<&str> for ClientSecret
impl PartialEq<&str> for ClientSecret
source§impl PartialEq<Box<ClientSecret>> for &ClientSecret
impl PartialEq<Box<ClientSecret>> for &ClientSecret
source§impl PartialEq<Box<ClientSecret>> for ClientSecret
impl PartialEq<Box<ClientSecret>> for ClientSecret
source§impl PartialEq<ClientSecret> for &str
impl PartialEq<ClientSecret> for &str
source§fn eq(&self, other: &ClientSecret) -> bool
fn eq(&self, other: &ClientSecret) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<ClientSecret> for OwnedClientSecret
impl PartialEq<ClientSecret> for OwnedClientSecret
source§fn eq(&self, other: &ClientSecret) -> bool
fn eq(&self, other: &ClientSecret) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<ClientSecret> for str
impl PartialEq<ClientSecret> for str
source§fn eq(&self, other: &ClientSecret) -> bool
fn eq(&self, other: &ClientSecret) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<OwnedClientSecret> for &ClientSecret
impl PartialEq<OwnedClientSecret> for &ClientSecret
source§fn eq(&self, other: &OwnedClientSecret) -> bool
fn eq(&self, other: &OwnedClientSecret) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<OwnedClientSecret> for ClientSecret
impl PartialEq<OwnedClientSecret> for ClientSecret
source§fn eq(&self, other: &OwnedClientSecret) -> bool
fn eq(&self, other: &OwnedClientSecret) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<String> for ClientSecret
impl PartialEq<String> for ClientSecret
source§impl PartialEq<str> for ClientSecret
impl PartialEq<str> for ClientSecret
source§impl PartialEq for ClientSecret
impl PartialEq for ClientSecret
source§fn eq(&self, other: &ClientSecret) -> bool
fn eq(&self, other: &ClientSecret) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for ClientSecret
impl PartialOrd for ClientSecret
source§fn partial_cmp(&self, other: &ClientSecret) -> Option<Ordering>
fn partial_cmp(&self, other: &ClientSecret) -> Option<Ordering>
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 moresource§impl Serialize for ClientSecret
impl Serialize for ClientSecret
source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
source§impl ToOwned for ClientSecret
impl ToOwned for ClientSecret
§type Owned = OwnedClientSecret
type Owned = OwnedClientSecret
source§fn to_owned(&self) -> <ClientSecret as ToOwned>::Owned
fn to_owned(&self) -> <ClientSecret as ToOwned>::Owned
1.63.0 · source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
source§impl<'a> TryFrom<&'a str> for &'a ClientSecret
impl<'a> TryFrom<&'a str> for &'a ClientSecret
impl Eq for ClientSecret
impl StructuralPartialEq for ClientSecret
Auto Trait Implementations§
impl Freeze for ClientSecret
impl RefUnwindSafe for ClientSecret
impl Send for ClientSecret
impl !Sized for ClientSecret
impl Sync for ClientSecret
impl Unpin for ClientSecret
impl UnwindSafe for ClientSecret
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
source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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
key
and return true
if they are equal.