Enum ion_schema::IonSchemaElement
source · [−]pub enum IonSchemaElement {
SingleElement(OwnedElement),
Document(Vec<OwnedElement>),
}Expand description
Provide an Ion schema element which includes all OwnedElements 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::value::owned::OwnedElement;
use ion_schema::IonSchemaElement;
// create an IonSchemaElement from an OwnedElement
let owned_element: OwnedElement = 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
SingleElement(OwnedElement)
Document(Vec<OwnedElement>)
Implementations
sourceimpl IonSchemaElement
impl IonSchemaElement
pub fn as_element(&self) -> Option<&OwnedElement>
pub fn as_document(&self) -> Option<&Vec<OwnedElement>>
Trait Implementations
sourceimpl Clone for IonSchemaElement
impl Clone for IonSchemaElement
sourcefn clone(&self) -> IonSchemaElement
fn clone(&self) -> IonSchemaElement
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for IonSchemaElement
impl Debug for IonSchemaElement
sourceimpl Display for IonSchemaElement
impl Display for IonSchemaElement
sourceimpl From<&OwnedElement> for IonSchemaElement
impl From<&OwnedElement> for IonSchemaElement
sourcefn from(value: &OwnedElement) -> Self
fn from(value: &OwnedElement) -> Self
Converts to this type from the input type.
sourceimpl From<&Vec<OwnedElement, Global>> for IonSchemaElement
impl From<&Vec<OwnedElement, Global>> for IonSchemaElement
sourcefn from(value: &Vec<OwnedElement>) -> Self
fn from(value: &Vec<OwnedElement>) -> Self
Converts to this type from the input type.
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more