Function journal_save

Source
pub fn journal_save(aim_path: &Path, journals: &Vec<Journal>) -> Result<()>
Expand description

Saves the journal vector to a .jnl file for the corresponding .aim file.

This function takes a vector of journal entries and writes them to a .jnl file that corresponds to the provided .aim file path. Each entry is written as “version,position” on a separate line.

§Arguments

  • aim_path - Path to the .aim file (used to derive the .jnl filename)
  • journals - Vector of journal entries to save

§Returns

  • Ok(()) on successful save
  • Err if the file cannot be created or written to

§Examples

use std::path::Path;
use aimx::aim::{Journal, journal_save};

let journals = vec![Journal::new(1, 0), Journal::new(2, 100)];
let result = journal_save(Path::new("workflow.aim"), &journals);