pub trait TwoDaSource {
// Required method
fn twoda(&mut self, name: impl AsRef<str>) -> Option<&TwoDa>;
}Expand description
Something that can produce a parsed 2DA table by name.
Implementors decide where tables come from and whether to cache
them; &mut self is there so a lazy implementation can populate
itself on a miss without interior mutability.
Required Methods§
Sourcefn twoda(&mut self, name: impl AsRef<str>) -> Option<&TwoDa>
fn twoda(&mut self, name: impl AsRef<str>) -> Option<&TwoDa>
Returns the named table, or None if it cannot be produced.
name is a bare table name with no .2da extension, so both a
&str literal and a TwoDaName constant work at the call
site.
The None case merges “no such table” with “the table would
not parse”. A decoder falls back to raw values either way, and
a caller that needs to tell the two apart should ask the
implementation directly rather than route that through
resolution.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.