identifiers: Add DeviceIdBox and ServerNameBox
This commit is contained in:
parent
662ce82bc2
commit
a842c5ccdc
@ -7,6 +7,7 @@ Breaking changes:
|
|||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
* Add `DeviceKeyId::from_parts` and `ServerKeyId::from_parts`
|
* Add `DeviceKeyId::from_parts` and `ServerKeyId::from_parts`
|
||||||
|
* Add `DeviceIdBox` and `ServerNameBox` type aliases
|
||||||
|
|
||||||
# 0.17.4
|
# 0.17.4
|
||||||
|
|
||||||
|
@ -17,6 +17,9 @@ use crate::generate_localpart;
|
|||||||
#[cfg_attr(feature = "serde", derive(serde1::Serialize), serde(transparent, crate = "serde1"))]
|
#[cfg_attr(feature = "serde", derive(serde1::Serialize), serde(transparent, crate = "serde1"))]
|
||||||
pub struct DeviceId(str);
|
pub struct DeviceId(str);
|
||||||
|
|
||||||
|
/// An owned device identifier.
|
||||||
|
pub type DeviceIdBox = Box<DeviceId>;
|
||||||
|
|
||||||
impl DeviceId {
|
impl DeviceId {
|
||||||
#[allow(clippy::transmute_ptr_to_ptr)]
|
#[allow(clippy::transmute_ptr_to_ptr)]
|
||||||
fn from_borrowed(s: &str) -> &Self {
|
fn from_borrowed(s: &str) -> &Self {
|
||||||
|
@ -16,9 +16,16 @@ use serde1::de::{self, Deserialize as _, Deserializer, Unexpected};
|
|||||||
|
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
device_id::DeviceId, device_key_id::DeviceKeyId, event_id::EventId, room_alias_id::RoomAliasId,
|
device_id::{DeviceId, DeviceIdBox},
|
||||||
room_id::RoomId, room_id_or_room_alias_id::RoomIdOrAliasId, room_version_id::RoomVersionId,
|
device_key_id::DeviceKeyId,
|
||||||
server_key_id::ServerKeyId, server_name::ServerName, user_id::UserId,
|
event_id::EventId,
|
||||||
|
room_alias_id::RoomAliasId,
|
||||||
|
room_id::RoomId,
|
||||||
|
room_id_or_room_alias_id::RoomIdOrAliasId,
|
||||||
|
room_version_id::RoomVersionId,
|
||||||
|
server_key_id::ServerKeyId,
|
||||||
|
server_name::{ServerName, ServerNameBox},
|
||||||
|
user_id::UserId,
|
||||||
};
|
};
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use ruma_identifiers_validation::{
|
pub use ruma_identifiers_validation::{
|
||||||
|
@ -17,6 +17,9 @@ use crate::Error;
|
|||||||
#[cfg_attr(feature = "serde", derive(serde1::Serialize), serde(transparent, crate = "serde1"))]
|
#[cfg_attr(feature = "serde", derive(serde1::Serialize), serde(transparent, crate = "serde1"))]
|
||||||
pub struct ServerName(str);
|
pub struct ServerName(str);
|
||||||
|
|
||||||
|
/// An owned server name.
|
||||||
|
pub type ServerNameBox = Box<ServerName>;
|
||||||
|
|
||||||
impl ServerName {
|
impl ServerName {
|
||||||
#[allow(clippy::transmute_ptr_to_ptr)]
|
#[allow(clippy::transmute_ptr_to_ptr)]
|
||||||
fn from_borrowed(s: &str) -> &Self {
|
fn from_borrowed(s: &str) -> &Self {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user