Skip to main content

get_unit

Function get_unit 

Source
pub fn get_unit(mana_dir: &Path, id: &str) -> Result<Unit, ManaError>
Expand description

Load a unit by ID.

Finds the unit file in the .mana/ directory and deserializes it. Works for active (non-archived) units only. For archived units, use get_archived_unit.

§Errors

§Example

use mana_core::api::get_unit;
use std::path::Path;

let mana_dir = Path::new("/project/.mana");
let unit = get_unit(mana_dir, "42").unwrap();
println!("{}: {}", unit.id, unit.title);