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: ⁨863a1d7

⁨giterated-models/src/repository/values.rs⁩ - ⁨1267⁩ bytes
Raw
1 use std::fmt::Display;
2
3 use serde::{Deserialize, Serialize};
4
5 use crate::{settings::Setting, value::GiteratedObjectValue};
6
7 use super::{Repository, RepositoryVisibility};
8
9 // pub struct RepositorySetting<V: GiteratedObjectValue>(pub V);
10
11 // impl<O: GiteratedObject, V: GiteratedObjectValue<Object = O> + Send> GiteratedOperation<O>
12 // for RepositorySetting<V>
13 // {
14 // fn operation_name(&self) -> &'static str {
15 // "setting_get"
16 // }
17 // type Success = V;
18 // type Failure = GetValueError;
19 // }
20
21 #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)]
22 pub struct Description(pub String);
23
24 impl Display for Description {
25 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26 f.write_str(&self.0)
27 }
28 }
29
30 impl GiteratedObjectValue for Description {
31 type Object = Repository;
32
33 fn value_name() -> &'static str {
34 "description"
35 }
36 }
37
38 impl Setting for Description {
39 fn name() -> &'static str {
40 "description"
41 }
42 }
43
44 #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)]
45 pub struct Visibility(pub RepositoryVisibility);
46
47 impl GiteratedObjectValue for Visibility {
48 type Object = Repository;
49
50 fn value_name() -> &'static str {
51 "visibility"
52 }
53 }
54