Skip to main content

VmDictExt

Trait VmDictExt 

Source
pub trait VmDictExt {
    // Required methods
    fn put(&mut self, key: &str, value: VmValue);
    fn put_str(&mut self, key: &str, value: impl AsRef<str>);
    fn put_opt_str(&mut self, key: &str, value: Option<impl AsRef<str>>);
    fn put_opt(&mut self, key: &str, value: Option<VmValue>);
    fn put_bool(&mut self, key: &str, value: bool);
    fn put_int(&mut self, key: &str, value: i64);
}
Expand description

Field-insertion helpers for a VmValue::Dict backing map.

Implemented for any [DictInsert] map (the transient BTreeMap builders and the persistent DictMap), so the methods are unavailable on unrelated maps and cannot be applied by mistake.

Required Methods§

Source

fn put(&mut self, key: &str, value: VmValue)

Inserts value under key (owning the key as a String).

Source

fn put_str(&mut self, key: &str, value: impl AsRef<str>)

Inserts a string value built via VmValue::string.

Source

fn put_opt_str(&mut self, key: &str, value: Option<impl AsRef<str>>)

Inserts a string value only when value is Some.

Source

fn put_opt(&mut self, key: &str, value: Option<VmValue>)

Inserts a VmValue only when value is Some.

Source

fn put_bool(&mut self, key: &str, value: bool)

Inserts a boolean value.

Source

fn put_int(&mut self, key: &str, value: i64)

Inserts an integer value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<M: DictInsert> VmDictExt for M