feat: fixed file management

This commit is contained in:
Strix 2023-10-14 22:39:39 +02:00
parent 36c782a564
commit 5083e2ba9b
No known key found for this signature in database
GPG key ID: 49B2E37B8915B774
12 changed files with 148 additions and 43 deletions

View file

@ -1,7 +1,8 @@
use std::collections::HashMap;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)]
pub struct Bin {
pub root: String,
pub checksums: HashMap<String, String>
}

View file

@ -1,5 +1,5 @@
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::{collections::HashMap, str::FromStr};
pub mod package;
pub mod fs;
@ -18,6 +18,22 @@ pub struct Manifest<P = Option<pkgr::PKGR>> {
pub pkgr: P
}
impl<T> Manifest<T> {
pub fn valid(&self) -> bool {
if self.bin.is_none() && self.build.is_none() {
return false
}
true
}
}
impl FromStr for Manifest {
type Err = toml::de::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
toml::from_str(s)
}
}
impl Default for Manifest {
fn default() -> Self {
Manifest {