pub fn index_str(s: &str) -> IndexStr<'_>Notable traits for IndexStr<'a>impl<'a> Iterator for IndexStr<'a>    type Item = PathElement<'a>;
Expand description

Generate an iterator of PathElement from a string

Panics

Panics if the string is not valid, see try_index_str for the details and a non-panicking version.

Example

use cbor_data::{CborBuilder, index_str, Encoder, value::Number};

let cbor = CborBuilder::new().encode_array(|builder| {
    builder.encode_u64(42);
});

let item = cbor.index(index_str("[0]")).unwrap();
assert_eq!(item.decode().to_number().unwrap(), Number::Int(42));