Try to work on build some more.

This commit is contained in:
Cutieguwu
2026-02-15 12:25:03 -05:00
parent a9fb52d8d7
commit 0fad1b74bc
5 changed files with 114 additions and 7 deletions

View File

@@ -8,3 +8,28 @@ pub struct Class {
pub path: PathBuf,
pub checksum: String,
}
impl Class {
pub fn is_updated(&self) -> crate::Result<bool> {
// If the path is local and that file has not been updated.
Ok(self.checksum == sha256::try_digest(self.path.clone())?)
}
pub fn update(&mut self) -> crate::Result<()> {
self.checksum = sha256::try_digest(self.path.clone())?;
Ok(())
}
}
// TODO: Make it clearer that this is for general files,
// not nests.
impl TryFrom<PathBuf> for Class {
type Error = crate::Error;
fn try_from(value: PathBuf) -> Result<Self, Self::Error> {
Ok(Self {
path: value.clone(),
checksum: sha256::try_digest(value)?,
})
}
}