pub struct ConfigView<'a> { /* private fields */ }Expand description
Borrowed typed accessors over one config table.
Implementations§
Source§impl<'a> ConfigView<'a>
impl<'a> ConfigView<'a>
Sourcepub fn new(table: &'a ConfigTable) -> Self
pub fn new(table: &'a ConfigTable) -> Self
Creates a view over table.
Sourcepub fn from_entries(entries: &'a [(Expr, Expr)]) -> Self
pub fn from_entries(entries: &'a [(Expr, Expr)]) -> Self
Creates a view over already-borrowed table entries.
Sourcepub fn required_string(&self, key: &str) -> ConfigResult<&'a str>
pub fn required_string(&self, key: &str) -> ConfigResult<&'a str>
Reads a required string field.
Sourcepub fn required_bool(&self, key: &str) -> ConfigResult<bool>
pub fn required_bool(&self, key: &str) -> ConfigResult<bool>
Reads a required boolean field.
Sourcepub fn required_i64(&self, key: &str) -> ConfigResult<i64>
pub fn required_i64(&self, key: &str) -> ConfigResult<i64>
Reads a required integer field.
Sourcepub fn string_array(&self, key: &str) -> ConfigResult<Vec<String>>
pub fn string_array(&self, key: &str) -> ConfigResult<Vec<String>>
Reads an optional list of string values.
Missing fields read as an empty vector so callers can treat absent arrays as the natural zero value. A present non-list field, or any non-string list item, is reported as a type mismatch.
Sourcepub fn tables(&self, key: &str) -> ConfigResult<Vec<ConfigView<'a>>>
pub fn tables(&self, key: &str) -> ConfigResult<Vec<ConfigView<'a>>>
Reads an optional repeated table field as borrowed table views.
Config codecs represent [[name]] repeated tables as a list of map
expressions. Missing fields read as an empty vector. A present field must
be a list whose items are maps.
Trait Implementations§
Source§impl<'a> Clone for ConfigView<'a>
impl<'a> Clone for ConfigView<'a>
Source§fn clone(&self) -> ConfigView<'a>
fn clone(&self) -> ConfigView<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for ConfigView<'a>
Auto Trait Implementations§
impl<'a> Freeze for ConfigView<'a>
impl<'a> RefUnwindSafe for ConfigView<'a>
impl<'a> Send for ConfigView<'a>
impl<'a> Sync for ConfigView<'a>
impl<'a> Unpin for ConfigView<'a>
impl<'a> UnsafeUnpin for ConfigView<'a>
impl<'a> UnwindSafe for ConfigView<'a>
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