use semver::Version;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Package {
pub name: String,
pub version: Version,
pub authors: Vec<String>,
pub edition: String,
}
impl Default for Package {
fn default() -> Self {
Self {
name: "addition".to_string(),
version: Version::new(0, 1, 0),
authors: vec![],
edition: "2021".to_string(),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Lib {
#[serde(rename = "crate-type")]
pub crate_type: Vec<String>,
}
impl Default for Lib {
fn default() -> Self {
Self {
crate_type: vec!["cdylib".to_string()],
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Dependencies {
pub zink: Version,
}
impl Default for Dependencies {
fn default() -> Self {
Self {
zink: Version::new(0, 1, 0),
}
}
}
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
pub struct Manifest {
pub package: Package,
pub lib: Lib,
pub dependencies: Dependencies,
}
impl Manifest {
pub fn name(&mut self, name: &str) -> &mut Self {
self.package.name = name.to_string();
self
}
}