Skip to main content

ion_seq

Macro ion_seq 

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

Constructs a Sequence with the specified child values.

Note that a Sequence is NOT a type of Element. However, one can convert a Sequence into a List or SExp.

use ion_rs::{Element, ion_seq, ion_list, Sequence};
// Construct a Sequence from serialized Ion data
let expected: Sequence = Element::read_all(r#" "foo" 7 false [1.5e0, -8.25e0] "#).unwrap();
// Construct a Sequence from Rust values
let actual: Sequence = ion_seq!("foo" 7 false ion_list![1.5f64, -8.25f64]);
// Compare the two Sequences
assert_eq!(expected, actual);

// The ion_seq! macro can also accept a comma-delimited list of Rust values to convert
let actual: Sequence = ion_seq!["foo", 7, false, ion_list![1.5f64, -8.25f64]];
assert_eq!(expected, actual);