diff --git a/src/loaders/sources.rs b/src/loaders/sources.rs index 04a3459..633f7ae 100644 --- a/src/loaders/sources.rs +++ b/src/loaders/sources.rs @@ -1,10 +1,11 @@ use std::fs::File; use std::io::{self, BufRead}; use std::path::Path; - +use std::fs; +use std::error::Error; +use serde::Serialize; use crate::structs::{AptSource, RepoType}; -/// Loads Debian APT sources from a given file path (e.g., "/etc/apt/sources.list") pub fn load_sources(path: &str) -> io::Result> { let file = File::open(Path::new(path))?; let reader = io::BufReader::new(file); @@ -55,15 +56,7 @@ pub fn load_sources(path: &str) -> io::Result> { Ok(sources) } -use std::fs; -use std::error::Error; -use serde::Serialize; - -/// Save sources into a TOML file with a top-level `repositories` array-of-tables pub fn save_sources_to_toml(sources: &[AptSource], path: &str) -> Result<(), Box> { - // tiny wrapper so toml serializes into: - // [[repositories]] - // ... #[derive(Serialize)] struct Repos<'a> { repositories: &'a [AptSource],