JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

Fixes

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨b87f0a3

⁨giterated-models/src/user/values.rs⁩ - ⁨727⁩ bytes
Raw
1 use std::fmt::Display;
2
3 use serde::{Deserialize, Serialize};
4
5 use crate::value::GiteratedObjectValue;
6
7 use super::User;
8
9 #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)]
10 pub struct Bio(pub String);
11
12 impl GiteratedObjectValue for Bio {
13 type Object = User;
14
15 fn value_name() -> &'static str {
16 "bio"
17 }
18 }
19
20 #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)]
21 pub struct DisplayName(pub String);
22
23 impl Display for DisplayName {
24 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25 f.write_str(&self.0)
26 }
27 }
28
29 impl GiteratedObjectValue for DisplayName {
30 type Object = User;
31
32 fn value_name() -> &'static str {
33 "display_name"
34 }
35 }
36