kernel/install/
provider.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
7#[serde(transparent)]
8pub struct InstallProviderId(String);
9
10impl InstallProviderId {
11 pub fn huggingface() -> Self {
13 Self("huggingface".to_owned())
14 }
15
16 pub fn ollama() -> Self {
18 Self("ollama".to_owned())
19 }
20
21 pub fn as_str(&self) -> &str {
23 &self.0
24 }
25}
26
27impl From<&str> for InstallProviderId {
28 fn from(value: &str) -> Self {
29 Self(value.to_owned())
30 }
31}
32
33impl std::fmt::Display for InstallProviderId {
34 fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35 formatter.write_str(&self.0)
36 }
37}
38
39#[derive(Debug, Clone, PartialEq, Eq, Hash)]
41pub enum InstallAvailability {
42 Ready,
44 Unavailable {
46 hint: String,
48 },
49}