Skip to main content

ValueIndex

Trait ValueIndex 

Source
pub trait ValueIndex: Sealed { }
Expand description

A type that can index into a Value.

Sequences are indexed by usize, maps by strings or any other Value as key. This is used by Kind::get and the Index implementation of Value.

use deser_value::value;

let value = value!({"items": [1, 2], 42: "answer"});
assert_eq!(value["items"][1], 2);
assert_eq!(value[&value!(42)], "answer");
assert!(value["missing"].is_null());

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl ValueIndex for String

Source§

impl ValueIndex for str

Source§

impl ValueIndex for usize

Source§

impl<T: ValueIndex + ?Sized> ValueIndex for &T

Implementors§