
- Fixed Sabbath School parser to handle API data with extra line breaks - Cleaned up project structure and removed nested directories - Organized output to single directory structure - Removed YouTube link from contact section for cleaner layout - Improved parser robustness for multi-line content between labels - Added proper .gitignore for Rust project
24 lines
771 B
Rust
24 lines
771 B
Rust
use serde::{Deserialize, Serialize};
|
|
use std::path::Path;
|
|
use anyhow::Result;
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct Config {
|
|
pub church_name: String,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub contact_phone: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub contact_website: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub contact_youtube: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub contact_address: Option<String>,
|
|
}
|
|
|
|
impl Config {
|
|
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self> {
|
|
let content = std::fs::read_to_string(path)?;
|
|
let config: Config = toml::from_str(&content)?;
|
|
Ok(config)
|
|
}
|
|
} |