#[repr(u8)]pub enum OM<'de, I> {
OMI {
int: Int<'de>,
attrs: Vec<OMAttr<'de, I>>,
},
OMF {
float: f64,
attrs: Vec<OMAttr<'de, I>>,
},
OMSTR {
string: Cow<'de, str>,
attrs: Vec<OMAttr<'de, I>>,
},
OMB {
bytes: Cow<'de, [u8]>,
attrs: Vec<OMAttr<'de, I>>,
},
OMV {
name: Cow<'de, str>,
attrs: Vec<OMAttr<'de, I>>,
},
OMS {
cd: Cow<'de, str>,
name: Cow<'de, str>,
attrs: Vec<OMAttr<'de, I>>,
},
OMA {
applicant: I,
arguments: SmallVec<I, 2>,
attrs: Vec<OMAttr<'de, I>>,
},
OMBIND {
binder: I,
variables: SmallVec<(Cow<'de, str>, Vec<OMAttr<'de, I>>), 2>,
object: I,
attrs: Vec<OMAttr<'de, I>>,
},
OME {
cdbase: Option<Cow<'de, str>>,
cd: Cow<'de, str>,
name: Cow<'de, str>,
arguments: Vec<OMMaybeForeign<'de, I>>,
attrs: Vec<OMAttr<'de, I>>,
},
}Expand description
Enum for deserializing from OpenMath. See see OMDeserializable for documentation and an example.
Note that there is no case for OMATTR - instead,
every case has a Vec<OMAttr<’de, I>>, which is usually empty.
Otherwise, we’d have to either deal with two separate types, or have the
nonsensical case OMATTR(OMATTR(OMATTR(...),...),...), which would also
require a Box-indirection (hence allocation), etc. since OMATTR is mostly used
for metadata which the recipient might not even care about, or only care secondarily
(compared to the actual OM-kind), having OMATTR be a separate case seems
like bad API design.
Also, empty Vecs are cheap.
Variants§
OMI
OMF
OMSTR
OMB
OMV
A Variable must have a name which is a sequence of characters matching a regular expression, as described in Section 2.3.
(Note: We do not enforce that names are valid XML names;)
OMS
A Symbol encodes three fields of information, a symbol name, a Content Dictionary name, and (optionally) a Content Dictionary base URI, The name of a symbol is a sequence of characters matching the regular expression described in Section 2.3. The Content Dictionary is the location of the definition of the symbol, consisting of a name (a sequence of characters matching the regular expression described in Section 2.3) and, optionally, a unique prefix called a cdbase which is used to disambiguate multiple Content Dictionaries of the same name. There are other properties of the symbol that are not explicit in these fields but whose values may be obtained by inspecting the Content Dictionary specified. These include the symbol definition, formal properties and examples and, optionally, a role which is a restriction on where the symbol may appear in an OpenMath object. The possible roles are described in Section 2.1.4.
OMA
OMBIND
OME
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'de, I> Freeze for OM<'de, I>where
I: Freeze,
impl<'de, I> RefUnwindSafe for OM<'de, I>where
I: RefUnwindSafe,
impl<'de, I> Send for OM<'de, I>where
I: Send,
impl<'de, I> Sync for OM<'de, I>where
I: Sync,
impl<'de, I> Unpin for OM<'de, I>where
I: Unpin,
impl<'de, I> UnwindSafe for OM<'de, I>where
I: UnwindSafe + RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more