entrenar/ecosystem/realizar/
metadata.rs1use super::provenance::ExperimentProvenance;
4use serde::{Deserialize, Serialize};
5use std::collections::HashMap;
6
7#[derive(Debug, Clone, Default, Serialize, Deserialize)]
9pub struct GgufMetadata {
10 pub general: GeneralMetadata,
12 pub provenance: Option<ExperimentProvenance>,
14 pub custom: HashMap<String, String>,
16}
17
18#[derive(Debug, Clone, Default, Serialize, Deserialize)]
20pub struct GeneralMetadata {
21 pub architecture: String,
23 pub name: String,
25 pub author: Option<String>,
27 pub description: Option<String>,
29 pub license: Option<String>,
31 pub url: Option<String>,
33 pub file_type: Option<String>,
35}
36
37impl GeneralMetadata {
38 pub fn new(architecture: impl Into<String>, name: impl Into<String>) -> Self {
40 Self {
41 architecture: architecture.into(),
42 name: name.into(),
43 author: None,
44 description: None,
45 license: None,
46 url: None,
47 file_type: None,
48 }
49 }
50
51 pub fn with_author(mut self, author: impl Into<String>) -> Self {
53 self.author = Some(author.into());
54 self
55 }
56
57 pub fn with_description(mut self, desc: impl Into<String>) -> Self {
59 self.description = Some(desc.into());
60 self
61 }
62
63 pub fn with_license(mut self, license: impl Into<String>) -> Self {
65 self.license = Some(license.into());
66 self
67 }
68}