Adjust imports and add webp conversion.

This commit is contained in:
Olivia Brooks
2025-10-13 20:24:39 -04:00
parent 7a7ba5d21b
commit 6f8a8bda96
7 changed files with 177 additions and 7 deletions

View File

@@ -1,12 +1,11 @@
use crate::error;
use std;
use std::fs::File;
use std::path::{Path, PathBuf};
use chrono::NaiveDate;
use ron::error::SpannedResult;
use serde::{Deserialize, Deserializer, de::DeserializeOwned};
use std::{
fs::File,
path::{Path, PathBuf},
};
const SANE_DATE_FORMAT: &str = "%Y-%m-%d";

View File

@@ -1,6 +1,7 @@
use clap::Parser;
use std::path::PathBuf;
use clap::Parser;
#[derive(Debug, Parser)]
#[clap(author, version, about)]
pub struct Args {

View File

@@ -2,12 +2,13 @@ mod blog;
mod cli;
mod error;
mod og;
mod webp;
use crate::blog::Meta;
use std::io::Read;
use clap::Parser;
use markdown;
use std::io::Read;
fn main() {
let config = cli::Args::parse();

View File

@@ -1,6 +1,7 @@
use serde::Deserialize;
use std::fmt;
use serde::Deserialize;
#[derive(Clone, Debug, Deserialize)]
pub enum Gender {
Male,

12
src/webp.rs Normal file
View File

@@ -0,0 +1,12 @@
use std::path::Path;
use image::ImageReader;
fn to_webp(path: &Path) -> Result<(), Box<dyn std::error::Error>> {
ImageReader::open(path)?.decode()?.save(format!(
"{}.webp",
path.file_stem().unwrap().to_str().unwrap()
))?;
Ok(())
}