Replace Box<MxcUri> with OwnedMxcUri
This commit is contained in:
parent
e136f486db
commit
4014e6959f
@ -5,7 +5,7 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixmediav3upload
|
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixmediav3upload
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, MxcUri};
|
use ruma_common::{api::ruma_api, OwnedMxcUri};
|
||||||
|
|
||||||
ruma_api! {
|
ruma_api! {
|
||||||
metadata: {
|
metadata: {
|
||||||
@ -50,7 +50,7 @@ pub mod v3 {
|
|||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// The MXC URI for the uploaded content.
|
/// The MXC URI for the uploaded content.
|
||||||
pub content_uri: Box<MxcUri>,
|
pub content_uri: OwnedMxcUri,
|
||||||
|
|
||||||
/// The [BlurHash](https://blurha.sh) for the uploaded content.
|
/// The [BlurHash](https://blurha.sh) for the uploaded content.
|
||||||
///
|
///
|
||||||
@ -83,7 +83,7 @@ pub mod v3 {
|
|||||||
|
|
||||||
impl Response {
|
impl Response {
|
||||||
/// Creates a new `Response` with the given MXC URI.
|
/// Creates a new `Response` with the given MXC URI.
|
||||||
pub fn new(content_uri: Box<MxcUri>) -> Self {
|
pub fn new(content_uri: OwnedMxcUri) -> Self {
|
||||||
Self {
|
Self {
|
||||||
content_uri,
|
content_uri,
|
||||||
#[cfg(feature = "unstable-msc2448")]
|
#[cfg(feature = "unstable-msc2448")]
|
||||||
|
@ -7,7 +7,7 @@ pub mod v3 {
|
|||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, MxcUri, OwnedUserId, RoomId};
|
use ruma_common::{api::ruma_api, OwnedMxcUri, OwnedUserId, RoomId};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
ruma_api! {
|
ruma_api! {
|
||||||
@ -68,7 +68,7 @@ pub mod v3 {
|
|||||||
feature = "compat",
|
feature = "compat",
|
||||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||||
)]
|
)]
|
||||||
pub avatar_url: Option<Box<MxcUri>>,
|
pub avatar_url: Option<OwnedMxcUri>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RoomMember {
|
impl RoomMember {
|
||||||
|
@ -5,7 +5,7 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3profileuseridavatar_url
|
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3profileuseridavatar_url
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, MxcUri, UserId};
|
use ruma_common::{api::ruma_api, OwnedMxcUri, UserId};
|
||||||
|
|
||||||
ruma_api! {
|
ruma_api! {
|
||||||
metadata: {
|
metadata: {
|
||||||
@ -36,7 +36,7 @@ pub mod v3 {
|
|||||||
feature = "compat",
|
feature = "compat",
|
||||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||||
)]
|
)]
|
||||||
pub avatar_url: Option<Box<MxcUri>>,
|
pub avatar_url: Option<OwnedMxcUri>,
|
||||||
|
|
||||||
/// The [BlurHash](https://blurha.sh) for the avatar pointed to by `avatar_url`.
|
/// The [BlurHash](https://blurha.sh) for the avatar pointed to by `avatar_url`.
|
||||||
///
|
///
|
||||||
@ -63,7 +63,7 @@ pub mod v3 {
|
|||||||
|
|
||||||
impl Response {
|
impl Response {
|
||||||
/// Creates a new `Response` with the given avatar URL.
|
/// Creates a new `Response` with the given avatar URL.
|
||||||
pub fn new(avatar_url: Option<Box<MxcUri>>) -> Self {
|
pub fn new(avatar_url: Option<OwnedMxcUri>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
avatar_url,
|
avatar_url,
|
||||||
#[cfg(feature = "unstable-msc2448")]
|
#[cfg(feature = "unstable-msc2448")]
|
||||||
|
@ -5,7 +5,7 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3profileuserid
|
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3profileuserid
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, MxcUri, UserId};
|
use ruma_common::{api::ruma_api, OwnedMxcUri, UserId};
|
||||||
|
|
||||||
ruma_api! {
|
ruma_api! {
|
||||||
metadata: {
|
metadata: {
|
||||||
@ -36,7 +36,7 @@ pub mod v3 {
|
|||||||
feature = "compat",
|
feature = "compat",
|
||||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||||
)]
|
)]
|
||||||
pub avatar_url: Option<Box<MxcUri>>,
|
pub avatar_url: Option<OwnedMxcUri>,
|
||||||
|
|
||||||
/// The user's display name, if set.
|
/// The user's display name, if set.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
@ -67,7 +67,7 @@ pub mod v3 {
|
|||||||
|
|
||||||
impl Response {
|
impl Response {
|
||||||
/// Creates a new `Response` with the given avatar URL and display name.
|
/// Creates a new `Response` with the given avatar URL and display name.
|
||||||
pub fn new(avatar_url: Option<Box<MxcUri>>, displayname: Option<String>) -> Self {
|
pub fn new(avatar_url: Option<OwnedMxcUri>, displayname: Option<String>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
avatar_url,
|
avatar_url,
|
||||||
displayname,
|
displayname,
|
||||||
|
@ -12,7 +12,7 @@ pub mod v3 {
|
|||||||
api::ruma_api,
|
api::ruma_api,
|
||||||
events::{AnyRoomEvent, AnyStateEvent},
|
events::{AnyRoomEvent, AnyStateEvent},
|
||||||
serde::{Incoming, Raw, StringEnum},
|
serde::{Incoming, Raw, StringEnum},
|
||||||
MxcUri, OwnedEventId, OwnedRoomId, OwnedUserId,
|
OwnedEventId, OwnedMxcUri, OwnedRoomId, OwnedUserId,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
@ -489,7 +489,7 @@ pub mod v3 {
|
|||||||
feature = "compat",
|
feature = "compat",
|
||||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||||
)]
|
)]
|
||||||
pub avatar_url: Option<Box<MxcUri>>,
|
pub avatar_url: Option<OwnedMxcUri>,
|
||||||
|
|
||||||
/// The user's display name, if set.
|
/// The user's display name, if set.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
@ -10,7 +10,7 @@ pub mod v3 {
|
|||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api,
|
api::ruma_api,
|
||||||
serde::{JsonObject, StringEnum},
|
serde::{JsonObject, StringEnum},
|
||||||
MxcUri,
|
OwnedMxcUri,
|
||||||
};
|
};
|
||||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||||
use serde_json::Value as JsonValue;
|
use serde_json::Value as JsonValue;
|
||||||
@ -177,7 +177,7 @@ pub mod v3 {
|
|||||||
pub name: String,
|
pub name: String,
|
||||||
|
|
||||||
/// The icon for the provider.
|
/// The icon for the provider.
|
||||||
pub icon: Option<Box<MxcUri>>,
|
pub icon: Option<OwnedMxcUri>,
|
||||||
|
|
||||||
/// The brand identifier for the provider.
|
/// The brand identifier for the provider.
|
||||||
pub brand: Option<IdentityProviderBrand>,
|
pub brand: Option<IdentityProviderBrand>,
|
||||||
|
@ -9,7 +9,7 @@ use ruma_common::{
|
|||||||
events::space::child::HierarchySpaceChildEvent,
|
events::space::child::HierarchySpaceChildEvent,
|
||||||
room::RoomType,
|
room::RoomType,
|
||||||
serde::{Raw, StringEnum},
|
serde::{Raw, StringEnum},
|
||||||
MxcUri, OwnedRoomAliasId, OwnedRoomId, RoomName,
|
OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId, RoomName,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ pub struct SpaceHierarchyRoomsChunk {
|
|||||||
feature = "compat",
|
feature = "compat",
|
||||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||||
)]
|
)]
|
||||||
pub avatar_url: Option<Box<MxcUri>>,
|
pub avatar_url: Option<OwnedMxcUri>,
|
||||||
|
|
||||||
/// The join rule of the room.
|
/// The join rule of the room.
|
||||||
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
|
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
|
||||||
|
@ -6,7 +6,7 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3user_directorysearch
|
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3user_directorysearch
|
||||||
|
|
||||||
use js_int::{uint, UInt};
|
use js_int::{uint, UInt};
|
||||||
use ruma_common::{api::ruma_api, MxcUri, OwnedUserId};
|
use ruma_common::{api::ruma_api, OwnedMxcUri, OwnedUserId};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
ruma_api! {
|
ruma_api! {
|
||||||
@ -93,7 +93,7 @@ pub mod v3 {
|
|||||||
feature = "compat",
|
feature = "compat",
|
||||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||||
)]
|
)]
|
||||||
pub avatar_url: Option<Box<MxcUri>>,
|
pub avatar_url: Option<OwnedMxcUri>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl User {
|
impl User {
|
||||||
|
@ -14,7 +14,7 @@ use serde::{
|
|||||||
};
|
};
|
||||||
use serde_json::Value as JsonValue;
|
use serde_json::Value as JsonValue;
|
||||||
|
|
||||||
use crate::{MxcUri, PrivOwnedStr, RoomName};
|
use crate::{OwnedMxcUri, PrivOwnedStr, RoomName};
|
||||||
|
|
||||||
/// A chunk of a room list response, describing one room.
|
/// A chunk of a room list response, describing one room.
|
||||||
///
|
///
|
||||||
@ -62,7 +62,7 @@ pub struct PublicRoomsChunk {
|
|||||||
feature = "compat",
|
feature = "compat",
|
||||||
serde(default, deserialize_with = "crate::serde::empty_string_as_none")
|
serde(default, deserialize_with = "crate::serde::empty_string_as_none")
|
||||||
)]
|
)]
|
||||||
pub avatar_url: Option<Box<MxcUri>>,
|
pub avatar_url: Option<OwnedMxcUri>,
|
||||||
|
|
||||||
/// The join rule of the room.
|
/// The join rule of the room.
|
||||||
#[serde(default, skip_serializing_if = "crate::serde::is_default")]
|
#[serde(default, skip_serializing_if = "crate::serde::is_default")]
|
||||||
|
@ -7,7 +7,7 @@ use ruma_macros::EventContent;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::ThumbnailInfo;
|
use super::ThumbnailInfo;
|
||||||
use crate::{events::EmptyStateKey, MxcUri};
|
use crate::{events::EmptyStateKey, OwnedMxcUri};
|
||||||
|
|
||||||
/// The content of an `m.room.avatar` event.
|
/// The content of an `m.room.avatar` event.
|
||||||
///
|
///
|
||||||
@ -23,7 +23,7 @@ pub struct RoomAvatarEventContent {
|
|||||||
pub info: Option<Box<ImageInfo>>,
|
pub info: Option<Box<ImageInfo>>,
|
||||||
|
|
||||||
/// URL of the avatar image.
|
/// URL of the avatar image.
|
||||||
pub url: Option<Box<MxcUri>>,
|
pub url: Option<OwnedMxcUri>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RoomAvatarEventContent {
|
impl RoomAvatarEventContent {
|
||||||
@ -59,7 +59,7 @@ pub struct ImageInfo {
|
|||||||
|
|
||||||
/// The URL to the thumbnail of the image.
|
/// The URL to the thumbnail of the image.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub thumbnail_url: Option<Box<MxcUri>>,
|
pub thumbnail_url: Option<OwnedMxcUri>,
|
||||||
|
|
||||||
/// The [BlurHash](https://blurha.sh) for this image.
|
/// The [BlurHash](https://blurha.sh) for this image.
|
||||||
///
|
///
|
||||||
|
@ -14,7 +14,8 @@ use crate::{
|
|||||||
StateEventType,
|
StateEventType,
|
||||||
},
|
},
|
||||||
serde::StringEnum,
|
serde::StringEnum,
|
||||||
MxcUri, OwnedServerName, OwnedServerSigningKeyId, OwnedUserId, PrivOwnedStr, RoomVersionId,
|
OwnedMxcUri, OwnedServerName, OwnedServerSigningKeyId, OwnedUserId, PrivOwnedStr,
|
||||||
|
RoomVersionId,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod change;
|
mod change;
|
||||||
@ -55,7 +56,7 @@ pub struct RoomMemberEventContent {
|
|||||||
feature = "compat",
|
feature = "compat",
|
||||||
serde(default, deserialize_with = "crate::serde::empty_string_as_none")
|
serde(default, deserialize_with = "crate::serde::empty_string_as_none")
|
||||||
)]
|
)]
|
||||||
pub avatar_url: Option<Box<MxcUri>>,
|
pub avatar_url: Option<OwnedMxcUri>,
|
||||||
|
|
||||||
/// The display name for this user, if any.
|
/// The display name for this user, if any.
|
||||||
///
|
///
|
||||||
|
@ -65,7 +65,7 @@ mod tests {
|
|||||||
|
|
||||||
use ruma_identifiers_validation::error::MxcUriError;
|
use ruma_identifiers_validation::error::MxcUriError;
|
||||||
|
|
||||||
use super::MxcUri;
|
use super::{MxcUri, OwnedMxcUri};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_mxc_uri() {
|
fn parse_mxc_uri() {
|
||||||
@ -102,7 +102,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn deserialize_mxc_uri() {
|
fn deserialize_mxc_uri() {
|
||||||
let mxc = serde_json::from_str::<Box<MxcUri>>(r#""mxc://server/1234id""#)
|
let mxc = serde_json::from_str::<OwnedMxcUri>(r#""mxc://server/1234id""#)
|
||||||
.expect("Failed to convert JSON to MxcUri");
|
.expect("Failed to convert JSON to MxcUri");
|
||||||
|
|
||||||
assert_eq!(mxc.as_str(), "mxc://server/1234id");
|
assert_eq!(mxc.as_str(), "mxc://server/1234id");
|
||||||
|
@ -7,7 +7,7 @@ pub mod v1 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.2/server-server-api/#get_matrixfederationv1queryprofile
|
//! [spec]: https://spec.matrix.org/v1.2/server-server-api/#get_matrixfederationv1queryprofile
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, serde::StringEnum, MxcUri, UserId};
|
use ruma_common::{api::ruma_api, serde::StringEnum, OwnedMxcUri, UserId};
|
||||||
|
|
||||||
use crate::PrivOwnedStr;
|
use crate::PrivOwnedStr;
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ pub mod v1 {
|
|||||||
feature = "compat",
|
feature = "compat",
|
||||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||||
)]
|
)]
|
||||||
pub avatar_url: Option<Box<MxcUri>>,
|
pub avatar_url: Option<OwnedMxcUri>,
|
||||||
|
|
||||||
/// The [BlurHash](https://blurha.sh) for the avatar pointed to by `avatar_url`.
|
/// The [BlurHash](https://blurha.sh) for the avatar pointed to by `avatar_url`.
|
||||||
///
|
///
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
directory::PublicRoomJoinRule, events::space::child::HierarchySpaceChildEvent, room::RoomType,
|
directory::PublicRoomJoinRule, events::space::child::HierarchySpaceChildEvent, room::RoomType,
|
||||||
serde::Raw, MxcUri, OwnedRoomAliasId, OwnedRoomId, RoomName,
|
serde::Raw, OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId, RoomName,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ pub struct SpaceHierarchyParentSummary {
|
|||||||
feature = "compat",
|
feature = "compat",
|
||||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||||
)]
|
)]
|
||||||
pub avatar_url: Option<Box<MxcUri>>,
|
pub avatar_url: Option<OwnedMxcUri>,
|
||||||
|
|
||||||
/// The join rule of the room.
|
/// The join rule of the room.
|
||||||
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
|
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
|
||||||
@ -184,7 +184,7 @@ pub struct SpaceHierarchyChildSummary {
|
|||||||
feature = "compat",
|
feature = "compat",
|
||||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||||
)]
|
)]
|
||||||
pub avatar_url: Option<Box<MxcUri>>,
|
pub avatar_url: Option<OwnedMxcUri>,
|
||||||
|
|
||||||
/// The join rule of the room.
|
/// The join rule of the room.
|
||||||
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
|
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user