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

ambee/giterated

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

Add support for networked GetSetting to Unified Stack refactor

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨da6d78e

⁨giterated-models/src/user/values.rs⁩ - ⁨861⁩ 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 impl Display for Bio {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 f.write_str(&self.0)
23 }
24 }
25
26 #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)]
27 pub struct DisplayName(pub String);
28
29 impl Display for DisplayName {
30 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31 f.write_str(&self.0)
32 }
33 }
34
35 impl GiteratedObjectValue for DisplayName {
36 type Object = User;
37
38 fn value_name() -> &'static str {
39 "display_name"
40 }
41 }
42