[][src]Enum binjs_meta::spec::TypeSpec

[]
pub enum TypeSpec {
    Array {
        contents: Box<Type>,
        supports_empty: bool,
    },
    NamedType(NodeName),
    TypeSum(TypeSum),
    Boolean,
    String,
    Number,
    UnsignedLong,
    Offset,
    Void,
    IdentifierName,
    PropertyKey,
}
[]

The contents of a type, typically that of a field.

Note that we generally use Type, to represent the fact that some fields accept null while others do not.

Variants

Array
[]

An array of values of the same type.

[]

Fields of Array

contents: Box<Type>

The type of values in the array.

supports_empty: bool

If true, the array may be empty.

NamedType(NodeName)
TypeSum(TypeSum)
Boolean
[]

A boolean.

String
[]

A string.

Number
[]

A number, as per JavaScript specifications.

UnsignedLong
Offset
[]

A number of bytes in the binary file.

This spec is used only internally, as a hidden field injected by deanonymization, to represent lazy fields.

Void
[]

Nothing.

For the moment, this spec is used only internally.

IdentifierName
[]

A string used to represent something bound in a scope (i.e. a variable, but not a property). At this level, we make no distinction between Identifier and IdentifierName.

Actually maps to a subset of IdentifierName in webidl.

PropertyKey
[]

A key for a property. For the time being, we make no distinction between variants such as LiteralPropertyName and IdentifierName-as-property-keys.

Methods

impl TypeSpec[src][]

pub fn array(self) -> Type[src]

pub fn non_empty_array(self) -> Type[src]

pub fn optional(self) -> Option<Type>[src]

pub fn required(self) -> Type[src]

pub fn typenames<'a>(&'a self) -> HashSet<&'a NodeName>[src]

pub fn get_primitive(&self, spec: &Spec) -> Option<IsNullable<Primitive>>[src]

Trait Implementations

impl Clone for TypeSpec[src][+]

impl Debug for TypeSpec[src][+]

impl Eq for TypeSpec[src]

impl HasInterfaces for TypeSpec[src][+]

impl PartialEq<TypeSpec> for TypeSpec[src][+]

impl StructuralEq for TypeSpec[src]

impl StructuralPartialEq for TypeSpec[src]

Auto Trait Implementations

impl !RefUnwindSafe for TypeSpec

impl !Send for TypeSpec

impl !Sync for TypeSpec

impl Unpin for TypeSpec

impl UnwindSafe for TypeSpec

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src][+]

impl<T> Borrow<T> for T where
    T: ?Sized
[src][+]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src][+]

impl<T> From<T> for T[src][+]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src][+]

impl<T> ToOwned for T where
    T: Clone
[src][+]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src][+]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src][+]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.