Most of the refactor. Need to switch machines.
This commit is contained in:
40
crates/core/src/meta.rs
Normal file
40
crates/core/src/meta.rs
Normal file
@@ -0,0 +1,40 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use semver::Version;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Data struct
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct Meta {
|
||||
pub name: String,
|
||||
pub version: Version,
|
||||
#[serde(skip_serializing_if = "<Option<_>>::is_none")]
|
||||
pub authors: Option<Vec<String>>,
|
||||
#[serde(skip_serializing_if = "<Option<_>>::is_none")]
|
||||
pub repository: Option<String>,
|
||||
#[serde(skip_serializing_if = "<Option<_>>::is_none")]
|
||||
pub license: Option<String>,
|
||||
#[serde(skip_serializing_if = "<Option<_>>::is_none")]
|
||||
pub license_file: Option<PathBuf>,
|
||||
}
|
||||
|
||||
impl Meta {
|
||||
pub fn new<S: ToString>(name: S) -> Self {
|
||||
let mut meta = Self::default();
|
||||
meta.name = name.to_string();
|
||||
meta
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Meta {
|
||||
fn default() -> Self {
|
||||
Meta {
|
||||
name: String::from("Main"),
|
||||
version: Version::new(0, 1, 0),
|
||||
authors: None,
|
||||
repository: None,
|
||||
license: None,
|
||||
license_file: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user