[−][src]Struct binjs::meta::export::TypeDeanonymizer
A tool designed to replace all anonymous types in a specification of the language by explicitly named types.
Consider the following mini-specifications for JSON:
interface Value {
attribute (Object or String or Number or Array or Boolean)? value;
}
interface Object {
attribute FrozenArray<Property> properties;
}
interface Property {
attribute DOMString name;
attribute Value value;
}
interface Array {
attribute FrozenArray<Value?> items;
}
// ... Skipping definitions of String, Number, Boolean
The deanonymizer will rewrite them as follows:
interface Value { // Deanonymized optional sum
attribute OptionalObjectOrStringOrNumberOrArrayOrBoolean value;
}
interface Object { // Deanonymized list
attribute ListOfProperty properties;
}
interface Property { // No change
attribute DOMString name;
attribute Value value;
}
interface Array { // Deanonymized list of options
attribute ListOfOptionalValue items;
}
// ... Skipping definitions of String, Number, Boolean
typedef ObjectOrStringOrNumberOrArrayOrBoolean? OptionalObjectOrStringOrNumberOrArrayOrBoolean;
typedef (Object
or String
or Number
or Array
or Boolean)
ObjectOrStringOrNumberOrArrayOrBoolean;
typedef FrozenArray<Property> ListOfProperty;
typedef FrozenArray<OptionalValue> ListOfOptionalValue;
typedef Value? Optionalvalue;
This deanonymization lets us cleanly define intermediate data structures and/or parsers implementing the webidl specification.
Methods
impl TypeDeanonymizer
[src]
pub fn new(spec: &Spec) -> TypeDeanonymizer
[src]
Create an empty TypeDeanonymizer.
pub fn supersums(
&self
) -> &HashMap<NodeName, HashSet<NodeName, RandomState>, RandomState>
[src]
&self
) -> &HashMap<NodeName, HashSet<NodeName, RandomState>, RandomState>
pub fn into_spec(self, options: SpecOptions) -> Spec
[src]
Convert into a new specification.
pub fn get_node_name(&self, name: &str) -> Option<NodeName>
[src]
If name
is the name of a (deanonymized) type, return the corresponding type.
Auto Trait Implementations
impl !RefUnwindSafe for TypeDeanonymizer
impl !Send for TypeDeanonymizer
impl !Sync for TypeDeanonymizer
impl Unpin for TypeDeanonymizer
impl UnwindSafe for TypeDeanonymizer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
[src]
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
fn as_any(&self) -> &(dyn Any + 'static)
[src]
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,