pub struct Struct { /* private fields */ }
Expand description
An in-memory representation of an Ion Struct
use ion_rs::element::Element;
use ion_rs::ion_struct;
let struct_ = ion_struct! {
"foo": 1,
"bar": true,
"baz": "hello"
};
assert_eq!(struct_.len(), 3);
assert_eq!(struct_.get("baz"), Some(&Element::string("hello")));
Implementations§
source§impl Struct
impl Struct
pub fn builder() -> StructBuilder
pub fn clone_builder(&self) -> StructBuilder
sourcepub fn fields(&self) -> impl Iterator<Item = (&Symbol, &Element)>
pub fn fields(&self) -> impl Iterator<Item = (&Symbol, &Element)>
Returns an iterator over the field name/value pairs in this Struct.
pub fn iter(&self) -> FieldIterator<'_>
pub fn get<A: AsSymbolRef>(&self, field_name: A) -> Option<&Element>
pub fn get_all<A: AsSymbolRef>(&self, field_name: A) -> FieldValuesIterator<'_>
Trait Implementations§
source§impl<K, V> FromIterator<(K, V)> for Structwhere
K: Into<Symbol>,
V: Into<Element>,
impl<K, V> FromIterator<(K, V)> for Structwhere K: Into<Symbol>, V: Into<Element>,
source§fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self
Returns an owned struct from the given iterator of field names/values.
source§impl<'a> IntoIterator for &'a Struct
impl<'a> IntoIterator for &'a Struct
source§impl PartialEq<Struct> for Struct
impl PartialEq<Struct> for Struct
impl Eq for Struct
Auto Trait Implementations§
impl RefUnwindSafe for Struct
impl Send for Struct
impl Sync for Struct
impl Unpin for Struct
impl UnwindSafe for Struct
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<V> IntoAnnotatedElement for Vwhere
V: Into<Value>,
impl<V> IntoAnnotatedElement for Vwhere V: Into<Value>,
source§fn with_annotations<I: IntoAnnotations>(self, annotations: I) -> Element
fn with_annotations<I: IntoAnnotations>(self, annotations: I) -> Element
Converts the value into an Element with the specified annotations.