macro_rules! ion_list {
    ($($element:expr),*) => { ... };
}
Expand description

Constructs a list Element with the specified child values.

use ion_rs::element::Element;
use ion_rs::ion_list;
// Construct a list Element from Rust values
let actual: Element = ion_list!["foo", 7, false, ion_list![1.5f64, -8.25f64]].into();
// Construct an Element from serialized Ion data
let expected = Element::read_one(r#"["foo", 7, false, [1.5e0, -8.25e0]]"#).unwrap();
// Compare the two Elements
assert_eq!(expected, actual);

Child values can be anything that implements Into<Element>, which includes existing Element values.

// Construct a list Element from existing Elements
use ion_rs::element::{Element, IntoAnnotatedElement};
use ion_rs::ion_list;

let string_element: Element = "foo".into();
let bool_element: Element = true.into();

let actual: Element = ion_list![
    string_element,
    bool_element,
    10i64.with_annotations(["bar"]), // .with_annotations() constructs an Element
    Element::clob("hello"),
    Element::symbol("world")
]
.into();
// Construct an Element from serialized Ion data
let expected = Element::read_one(r#"["foo", true, bar::10, {{"hello"}}, world]"#).unwrap();
// Compare the two Elements
assert_eq!(expected, actual);