Repository navigation
Expand file tree
/
Copy pathprojects.rs
More file actions
59 lines (53 loc) · 1.51 KB
/
Copy pathprojects.rs
File metadata and controls
59 lines (53 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use serde::{Deserialize, Serialize};
use std::fmt;
use crate::components::cards_list::CardsListItem;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Copy)]
#[serde(rename_all = "snake_case")]
pub enum ProjectTags {
Wasm,
Ai,
Blockchain,
Leptos,
Crate,
Tauri,
DistributedSystem,
RateLimiting,
Template,
Cli,
Rpc,
Web,
}
impl fmt::Display for ProjectTags {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let s = match self {
ProjectTags::Wasm => "WASM",
ProjectTags::Ai => "AI",
ProjectTags::Blockchain => "Blockchain",
ProjectTags::Leptos => "Leptos",
ProjectTags::Crate => "Crate",
ProjectTags::Tauri => "Tauri",
ProjectTags::DistributedSystem => "Distributed System",
ProjectTags::RateLimiting => "Rate Limiting",
ProjectTags::Template => "Template",
ProjectTags::Cli => "CLI",
ProjectTags::Rpc => "RPC",
ProjectTags::Web => "Web",
};
write!(f, "{}", s)
}
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub struct CommunityProject {
pub repo_url: String,
pub banner: String,
pub tags: Vec<ProjectTags>,
}
impl CardsListItem for CommunityProject {
type Tag = ProjectTags;
fn get_key(&self) -> String {
format!("project-{}", self.repo_url)
}
fn get_tags(&self) -> &Vec<ProjectTags> {
&self.tags
}
}