Enum ion_schema::IonSchemaElement
source · pub enum IonSchemaElement {
SingleElement(Element),
Document(Vec<Element>),
}
Expand description
Provide an Ion schema Element which includes all Elements and a document type
§Example:
In general TypeRef
validate()
takes in IonSchemaElement as the value to be validated.
In order to create an IonSchemaElement
:
use ion_rs::element::Element;
use ion_schema::IonSchemaElement;
// create an IonSchemaElement from an Element
let owned_element: Element = 4.into();
let ion_schema_element: IonSchemaElement = (&owned_element).into();
// create an IonSchemaElement for document type based on vector of owned elements
let document: IonSchemaElement = IonSchemaElement::Document(vec![owned_element]);
Variants§
Implementations§
source§impl IonSchemaElement
impl IonSchemaElement
pub fn as_element(&self) -> Option<&Element>
pub fn as_document(&self) -> Option<&Vec<Element>>
Trait Implementations§
source§impl Clone for IonSchemaElement
impl Clone for IonSchemaElement
source§fn clone(&self) -> IonSchemaElement
fn clone(&self) -> IonSchemaElement
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for IonSchemaElement
impl Debug for IonSchemaElement
source§impl Display for IonSchemaElement
impl Display for IonSchemaElement
source§impl From<&Element> for IonSchemaElement
impl From<&Element> for IonSchemaElement
source§impl PartialEq for IonSchemaElement
impl PartialEq for IonSchemaElement
source§fn eq(&self, other: &IonSchemaElement) -> bool
fn eq(&self, other: &IonSchemaElement) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for IonSchemaElement
Auto Trait Implementations§
impl RefUnwindSafe for IonSchemaElement
impl Send for IonSchemaElement
impl Sync for IonSchemaElement
impl Unpin for IonSchemaElement
impl UnwindSafe for IonSchemaElement
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