fn load(deck_path: &path::Path, mut schedule_path: path::PathBuf) -> Result<(backend::Scheduler, path::PathBuf), Error> {
    // Open files.
    let mut deck_file = fs::File::open(deck_path)?;
    let mut schedule_file = fs::OpenOptions::new()
        .read(true)
        .write(true)
        .create(true)
        .open(&schedule_path)?;
    // Get the absolute path to the schedule path before changing directory.
    schedule_path = fs::canonicalize(schedule_path)?;
    // Change the directory to the directory of the schedule file.
    let deck_path = fs::canonicalize(deck_path)?;
    env::set_current_dir(deck_path.parent().unwrap())?;
    // Read files.
    let mut deck_buffer = String::new();
    deck_file.read_to_string(&mut deck_buffer)?;
    let mut schedule_buffer = String::new();
    schedule_file.read_to_string(&mut schedule_buffer)?;
    // Parse.
    let deck = backend::Deck::parse(&deck_buffer)?;
    let schedule = if schedule_buffer.is_empty() {
        // When the file is empty (e.g. first time the schedule is loaded), use the default,
        // empty schedule.
        backend::Schedule::new(&deck.tag_settings[""])
    } else {
        backend::Schedule::parse(&schedule_buffer)?
    };

    Ok((backend::Scheduler::new(deck, schedule), schedule_path))
}
/// Load a deck and schedule.
///
/// This returns a scheduler and a path to the schedule (a canonicalized version of
/// `schedule_path`).
Load a deck and schedule.
This returns a scheduler and a path to the schedule (a canonicalized version of
`schedule_path`).
Load a deck and schedule . This returns a scheduler and a path to the schedule ( a canonicalized version of ` schedule_path ` ) .
fn load(deck_path: &path::Path, mut schedule_path: path::PathBuf) -> Result<(backend::Scheduler, path::PathBuf), Error> {
    // Open files.
    let mut deck_file = fs::File::open(deck_path)?;
    let mut schedule_file = fs::OpenOptions::new()
        .read(true)
        .write(true)
        .create(true)
        .open(&schedule_path)?;
    // Get the absolute path to the schedule path before changing directory.
    schedule_path = fs::canonicalize(schedule_path)?;
    // Change the directory to the directory of the schedule file.
    let deck_path = fs::canonicalize(deck_path)?;
    env::set_current_dir(deck_path.parent().unwrap())?;
    // Read files.
    let mut deck_buffer = String::new();
    deck_file.read_to_string(&mut deck_buffer)?;
    let mut schedule_buffer = String::new();
    schedule_file.read_to_string(&mut schedule_buffer)?;
    // Parse.
    let deck = backend::Deck::parse(&deck_buffer)?;
    let schedule = if schedule_buffer.is_empty() {
        // When the file is empty (e.g. first time the schedule is loaded), use the default,
        // empty schedule.
        backend::Schedule::new(&deck.tag_settings[""])
    } else {
        backend::Schedule::parse(&schedule_buffer)?
    };
    Ok((backend::Scheduler::new(deck, schedule), schedule_path))
}
fn load ( deck_path : & path :: Path , mut schedule_path : path :: PathBuf ) -> Result < ( backend :: Scheduler , path :: PathBuf ) , Error > { // Open files. let mut deck_file = fs :: File :: open ( deck_path ) ? ; let mut schedule_file = fs :: OpenOptions :: new ( ) . read ( true ) . write ( true ) . create ( true ) . open ( & schedule_path ) ? ; // Get the absolute path to the schedule path before changing directory. schedule_path = fs :: canonicalize ( schedule_path ) ? ; // Change the directory to the directory of the schedule file. let deck_path = fs :: canonicalize ( deck_path ) ? ; env :: set_current_dir ( deck_path . parent ( ) . unwrap ( ) ) ? ; // Read files. let mut deck_buffer = String :: new ( ) ; deck_file . read_to_string ( & mut deck_buffer ) ? ; let mut schedule_buffer = String :: new ( ) ; schedule_file . read_to_string ( & mut schedule_buffer ) ? ; // Parse. let deck = backend :: Deck :: parse ( & deck_buffer ) ? ; let schedule = if schedule_buffer . is_empty ( ) { // When the file is empty (e.g. first time the schedule is loaded), use the default, // empty schedule. backend :: Schedule :: new ( & deck . tag_settings [ " " ] ) } else { backend :: Schedule :: parse ( & schedule_buffer ) ? } ; Ok ( ( backend :: Scheduler :: new ( deck , schedule ) , schedule_path ) ) }
Load a deck and schedule.
Load a deck and schedule .
deck_path
&path::Path
schedule_path
path::PathBuf
deck_path
&path::Path
schedule_path
path::PathBuf