ProjectOptions#

Options passed to Project::new. They're fixed for the lifetime of the project. There's no setter, and a clone of the project keeps the same options. ProjectOptions::default() gives strict validation.

Declaration#

#[derive(Clone, Debug, Default)]
pub struct ProjectOptions {
    pub validation: Validation,
}

Fields#

Field Type Default Description
validation Validation Validation::Strict How the project validates the ProjectData it receives: reject invalid input, or repair it and report each change.

Example#

use plen_core::{Project, ProjectData, ProjectOptions, SolveOptions, Validation};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut project = Project::new(ProjectOptions {
        validation: Validation::Repair,
    });

    let result = project.solve(Some(ProjectData::default()), &SolveOptions::default())?;
    println!("{} notes", result.notes.len());
    Ok(())
}
  • Project::new - the constructor that takes these options
  • InputError - what strict validation returns for invalid input
  • Note - reports each fix made in repair mode
  • Accept messy input - turning on repair mode for imported data