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

ambee/giterated

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

Implement Display for RepositoryVisibility

Type: Chore

emilia - ⁨2⁩ years ago

parent: tbd commit: ⁨b5a1639

Showing ⁨⁨2⁩ changed files⁩ with ⁨⁨11⁩ insertions⁩ and ⁨⁨0⁩ deletions⁩

src/messages/repository.rs

View file
@@ -188,7 +188,10 @@ pub struct RepositoryIssue {
188 188 #[derive(Clone, Serialize, Deserialize)]
189 189 pub struct RepositoryInfoRequest {
190 190 pub repository: Repository,
191 /// Whether to fetch extra metadata like the last commit made to file or size
191 192 pub extra_metadata: bool,
193 /// Rev (branch) being requested
192 194 pub rev: Option<String>,
195 /// Tree path being requested
193 196 pub path: Option<String>,
194 197 }

src/model/repository.rs

View file
@@ -1,3 +1,4 @@
1 use std::fmt::{Display, Formatter};
1 2 use std::str::FromStr;
2 3
3 4 use serde::{Deserialize, Serialize};
@@ -69,6 +70,13 @@ pub enum RepositoryVisibility {
69 70 Private,
70 71 }
71 72
73 /// Implements [`Display`] for [`RepositoryVisiblity`] using [`Debug`]
74 impl Display for RepositoryVisibility {
75 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
76 write!(f, "{:?}", self)
77 }
78 }
79
72 80 #[derive(Clone, Debug, Serialize, Deserialize)]
73 81 pub struct RepositoryView {
74 82 /// Name of the repository