pub struct ConfigEntry<'a> { /* private fields */ }Expand description
A single configuration entry reference (zero-copy, no_std compatible).
Configuration entries follow DNS-SD TXT record format:
- Key-only (boolean flag):
"enabled" - Key with empty value:
"name=" - Key with value:
"version=1.0"
Keys must be printable US-ASCII (0x20-0x7E) excluding ‘=’.
Implementations§
Source§impl<'a> ConfigEntry<'a>
impl<'a> ConfigEntry<'a>
Sourcepub fn flag(key: &'a str) -> Result<Self, ConfigError>
pub fn flag(key: &'a str) -> Result<Self, ConfigError>
Sourcepub fn with_value(key: &'a str, value: &'a str) -> Result<Self, ConfigError>
pub fn with_value(key: &'a str, value: &'a str) -> Result<Self, ConfigError>
Sourcepub fn value(&self) -> Option<&'a str>
pub fn value(&self) -> Option<&'a str>
Get the entry value if present.
§Returns
Noneif this is a boolean flagSome("")if key ends with ‘=’Some(value)if key=value
Sourcepub fn from_str(s: &'a str) -> Result<Self, ConfigError>
pub fn from_str(s: &'a str) -> Result<Self, ConfigError>
Trait Implementations§
Source§impl<'a> Clone for ConfigEntry<'a>
impl<'a> Clone for ConfigEntry<'a>
Source§fn clone(&self) -> ConfigEntry<'a>
fn clone(&self) -> ConfigEntry<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for ConfigEntry<'a>
impl<'a> Debug for ConfigEntry<'a>
Source§impl<'a> PartialEq for ConfigEntry<'a>
impl<'a> PartialEq for ConfigEntry<'a>
impl<'a> Copy for ConfigEntry<'a>
impl<'a> Eq for ConfigEntry<'a>
impl<'a> StructuralPartialEq for ConfigEntry<'a>
Auto Trait Implementations§
impl<'a> Freeze for ConfigEntry<'a>
impl<'a> RefUnwindSafe for ConfigEntry<'a>
impl<'a> Send for ConfigEntry<'a>
impl<'a> Sync for ConfigEntry<'a>
impl<'a> Unpin for ConfigEntry<'a>
impl<'a> UnwindSafe for ConfigEntry<'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