pub struct Exporter { /* private fields */ }Expand description
Gathers data and writes it in the chosen format.
Implementations§
Source§impl Exporter
impl Exporter
Sourcepub fn new(format: ExportFormat, output_path: Option<PathBuf>) -> Self
pub fn new(format: ExportFormat, output_path: Option<PathBuf>) -> Self
Builds an exporter; without a path the file is named
kasl_export_{YYYYMMDD_HHMMSS}.{ext} in the current directory.
use kasl::libs::export::{Exporter, ExportFormat};
use std::path::PathBuf;
// Create exporter with default filename
let exporter = Exporter::new(ExportFormat::Csv, None);
// Create exporter with custom path
let custom_path = PathBuf::from("reports/daily_report.xlsx");
let exporter = Exporter::new(ExportFormat::Excel, Some(custom_path));Sourcepub fn hourly(self, hourly: bool) -> Self
pub fn hourly(self, hourly: bool) -> Self
Toggles the hourly (SiServer-style) layout; only Excel report exports honor it.
Sourcepub async fn export(&self, data_type: ExportData, date: NaiveDate) -> Result<()>
pub async fn export(&self, data_type: ExportData, date: NaiveDate) -> Result<()>
Runs the export for the requested data type.
use kasl::libs::export::{Exporter, ExportFormat, ExportData};
use chrono::NaiveDate;
let exporter = Exporter::new(ExportFormat::Json, None);
let date = NaiveDate::from_ymd_opt(2025, 1, 15).unwrap();
exporter.export(ExportData::Report, date).await?;Auto Trait Implementations§
impl Freeze for Exporter
impl RefUnwindSafe for Exporter
impl Send for Exporter
impl Sync for Exporter
impl Unpin for Exporter
impl UnsafeUnpin for Exporter
impl UnwindSafe for Exporter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more