[−][src]Struct encon::PlainMap
Similar to Map
, but with all fields decrypted into Value
s.
You can acquire this by calling Map::to_plain_map
with a password.
Implementations
impl PlainMap
[src]
pub fn new() -> Self
[src]
pub fn to_json_pretty(&self) -> Result<String, MapToJsonError>
[src]
Converts the PlainMap
to pretty-printed JSON.
pub fn to_json_compact(&self) -> Result<String, MapToJsonError>
[src]
Similar to to_json_pretty
, except printed as compactly as possible.
This is serde_json::to_string
, but named explicitly since you usually want
the to_json_pretty
variant.
pub fn to_value(&self) -> Value
[src]
Convert this to a serde_json::Value
(in the Object/Map variant).
pub fn insert(
&mut self,
key: impl Into<String>,
value: impl Into<Value>
) -> Option<Value>
[src]
&mut self,
key: impl Into<String>,
value: impl Into<Value>
) -> Option<Value>
Insert a Value
, returning the existing Value
, if any.
pub fn insert_before(
&mut self,
index: usize,
key: impl Into<String>,
value: impl Into<Value>
) -> Option<Value>
[src]
&mut self,
index: usize,
key: impl Into<String>,
value: impl Into<Value>
) -> Option<Value>
Inserts the item before the specified index. If the index is >= the number of items, it's simply appended to the end.
use encon::PlainMap; let mut map = PlainMap::new(); map.insert("foo", serde_json::json!("a")); map.insert("baz", serde_json::json!("c")); map.insert_before(1, "bar", serde_json::json!("b")); let keys = map.keys().map(|k| k as &str).collect::<Vec<_>>(); assert_eq!(keys, vec!["foo", "bar", "baz"]);
pub fn keys(&self) -> impl Iterator<Item = &String>
[src]
Return an iterator over the keys of the map, in their order
pub fn values(&self) -> impl Iterator<Item = &Value>
[src]
Return an iterator over the values of the map, in their order
pub fn entry(&mut self, key: String) -> Entry<'_, String, Value>
[src]
Get the given key’s corresponding entry in the map for insertion and/or in-place manipulation.
pub fn get(&self, key: impl Into<String>) -> Option<&Value>
[src]
Return a reference to the value stored for key, if it is present, else None.
pub fn get_mut(&mut self, key: impl Into<String>) -> Option<&mut Value>
[src]
Return a mutable reference to the value stored for key, if it is present, else None.
pub fn iter(&self) -> Iter<'_, String, Value>
[src]
Returns a double-ended iterator visiting all key-value pairs in order of insertion. Iterator element type is (&'a String, &'a mut Value)
pub fn iter_mut(&mut self) -> IterMut<'_, String, Value>
[src]
Returns a double-ended iterator visiting all key-value pairs in order of insertion. Iterator element type is (&'a String, &'a mut Value)
pub fn remove(&mut self, key: impl Into<String>) -> Option<Value>
[src]
Remove the entry for this key, and return it if it exists.
pub fn sort_keys(&mut self)
[src]
Remove the entry for this key, and return it if it exists.
pub fn reverse(&mut self)
[src]
pub fn len(&self) -> usize
[src]
Returns the number of elements in the map.
pub fn is_empty(&self) -> bool
[src]
Returns true if the map contains no elements.
Trait Implementations
impl Clone for PlainMap
[src]
impl Debug for PlainMap
[src]
impl Default for PlainMap
[src]
impl IntoIterator for PlainMap
[src]
type Item = (String, Value)
The type of the elements being iterated over.
type IntoIter = IntoIter<String, Value>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a> IntoIterator for &'a PlainMap
[src]
type Item = (&'a String, &'a Value)
The type of the elements being iterated over.
type IntoIter = Iter<'a, String, Value>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a> IntoIterator for &'a mut PlainMap
[src]
Auto Trait Implementations
impl RefUnwindSafe for PlainMap
impl Send for PlainMap
impl Sync for PlainMap
impl Unpin for PlainMap
impl UnwindSafe for PlainMap
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> I
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,