Add support for optional numbers

This commit is contained in:
Anton Danilkin
2018-08-03 16:28:35 +03:00
committed by Alex Crichton
parent 2a6d98a6c9
commit c49c18826d
25 changed files with 801 additions and 57 deletions

View File

@ -154,7 +154,27 @@ impl Descriptor {
}
}
pub fn get_64bit(&self) -> Option<bool> {
pub fn is_primitive(&self) -> bool {
match *self {
Descriptor::I32
| Descriptor::U32
| Descriptor::F32
| Descriptor::F64 => true,
_ => return false,
}
}
pub fn is_as_u32(&self) -> bool {
match *self {
Descriptor::I8
| Descriptor::U8
| Descriptor::I16
| Descriptor::U16 => true,
_ => return false,
}
}
pub fn get_64(&self) -> Option<bool> {
match *self {
Descriptor::I64 => Some(true),
Descriptor::U64 => Some(false),