ruma_common/profile/
static_profile_field.rs1#![allow(clippy::exhaustive_structs)]
4
5use ruma_common::OwnedMxcUri;
6#[cfg(feature = "unstable-msc4426")]
7use ruma_common::profile::{CallProfileField, StatusProfileField};
8use serde::{Serialize, de::DeserializeOwned};
9
10pub trait StaticProfileField {
15 type Value: Sized + Serialize + DeserializeOwned;
17
18 const NAME: &str;
20}
21
22#[derive(Debug, Clone, Copy)]
24pub struct AvatarUrl;
25
26impl StaticProfileField for AvatarUrl {
27 type Value = OwnedMxcUri;
28 const NAME: &str = "avatar_url";
29}
30
31#[derive(Debug, Clone, Copy)]
33pub struct DisplayName;
34
35impl StaticProfileField for DisplayName {
36 type Value = String;
37 const NAME: &str = "displayname";
38}
39
40#[derive(Debug, Clone, Copy)]
42pub struct TimeZone;
43
44impl StaticProfileField for TimeZone {
45 type Value = String;
46 const NAME: &str = "m.tz";
47}
48
49#[cfg(feature = "unstable-msc4426")]
51#[derive(Debug, Clone, Copy)]
52pub struct Status;
53
54#[cfg(feature = "unstable-msc4426")]
55impl StaticProfileField for Status {
56 type Value = StatusProfileField;
57 const NAME: &str = "org.matrix.msc4426.status";
58}
59
60#[cfg(feature = "unstable-msc4426")]
62#[derive(Debug, Clone, Copy)]
63pub struct Call;
64
65#[cfg(feature = "unstable-msc4426")]
66impl StaticProfileField for Call {
67 type Value = CallProfileField;
68 const NAME: &str = "org.matrix.msc4426.call";
69}