pub struct CodeLists { /* private fields */ }Expand description
Named EDIFACT-code-to-BO4E-name tables.
Implementations§
Source§impl CodeLists
impl CodeLists
pub fn get(&self, name: &str) -> Option<&BTreeMap<String, String>>
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn names(&self) -> impl Iterator<Item = &String>
pub fn from_toml_str(text: &str) -> Result<Self, String>
Sourcepub fn read(path: &Path) -> Result<Self, String>
pub fn read(path: &Path) -> Result<Self, String>
Read the tables from path, or an empty set when the file is absent.
Absent is not an error: a mappings tree that names no list needs no file, and every unit test builds definitions in a temporary directory.
Sourcepub fn discover(start: &Path) -> Arc<Self> ⓘ
pub fn discover(start: &Path) -> Arc<Self> ⓘ
Find and read the tables for a directory inside a mappings tree.
Definitions are loaded from mappings/<FV>/<variant>/<pid>/, and every
loader is handed one of those directories rather than the tree root, so
the file is found by walking up. Results are cached per resolved path:
a format version builds a couple of thousand engines, and each re-read
would parse the same file again.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CodeLists
impl<'de> Deserialize<'de> for CodeLists
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CodeLists
impl RefUnwindSafe for CodeLists
impl Send for CodeLists
impl Sync for CodeLists
impl Unpin for CodeLists
impl UnsafeUnpin for CodeLists
impl UnwindSafe for CodeLists
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