pub struct OptionView<'a> { /* private fields */ }Expand description
Read-only view over an OptionMap borrowed across the FFI.
The plugin contract hands the loader-owned &OptionMap to the plugin
for the duration of create; this wrapper gives plugin authors a
typed accessor surface without forcing them to construct a
HashMap<String, String> themselves.
Implementations§
Source§impl<'a> OptionView<'a>
impl<'a> OptionView<'a>
Sourcepub fn new(inner: &'a OptionMap) -> Self
pub fn new(inner: &'a OptionMap) -> Self
Wrap a borrow over an option map. The macro-generated entry point
typically reinterprets the incoming *const Options as
&OptionMap and hands it here.
Sourcepub unsafe fn from_raw_ptr(ptr: *const c_void) -> Option<Self>
pub unsafe fn from_raw_ptr(ptr: *const c_void) -> Option<Self>
Sourcepub fn get_str(&self, key: &str) -> Option<&str>
pub fn get_str(&self, key: &str) -> Option<&str>
Read a string option. Returns None if the key is absent or the
value isn’t a OptionValue::String.
Sourcepub fn get_u32(&self, key: &str) -> Option<u32>
pub fn get_u32(&self, key: &str) -> Option<u32>
Read a u32 option. Returns None if the key is absent or the
value isn’t a OptionValue::U32.
Sourcepub fn get_map(&self, key: &str) -> Option<OptionView<'_>>
pub fn get_map(&self, key: &str) -> Option<OptionView<'_>>
Read a nested map option. Returns None if the key is absent or
the value isn’t a OptionValue::Map.
Auto Trait Implementations§
impl<'a> Freeze for OptionView<'a>
impl<'a> RefUnwindSafe for OptionView<'a>
impl<'a> Send for OptionView<'a>
impl<'a> Sync for OptionView<'a>
impl<'a> Unpin for OptionView<'a>
impl<'a> UnsafeUnpin for OptionView<'a>
impl<'a> UnwindSafe for OptionView<'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