Skip to content

Commit

Permalink
Merge pull request #18 from messense/unsigned
Browse files Browse the repository at this point in the history
Add support for `unsigned` basic type
  • Loading branch information
domodwyer authored Jan 16, 2022
2 parents 1e1d125 + d2e6a52 commit a2b869a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/ast/basic_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl<'a> std::fmt::Display for BasicType {
impl<'a> From<&'a str> for BasicType {
fn from(v: &'a str) -> Self {
match v.trim() {
"unsigned int" | "uint32_t" | "u32" => Self::U32,
"unsigned int" | "uint32_t" | "u32" | "unsigned" => Self::U32,
"int" | "int32_t" | "i32" => Self::I32,
"unsigned hyper" | "uint64_t" | "u64" => Self::U64,
"hyper" | "int64_t" | "i64" => Self::I64,
Expand Down
2 changes: 1 addition & 1 deletion src/ast/indexes/generic_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl GenericIndex {
}

contains_opaque
};
}

let mut index: HashSet<String> = HashSet::new();
let mut last_size: isize = -1;
Expand Down
26 changes: 14 additions & 12 deletions src/impls/from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,13 @@ mod tests {
unsigned int a;
unsigned hyper b;
int c;
hyper d;
float e;
double f;
string g;
bool h;
opaque i;
unsigned d;
hyper e;
float f;
double g;
string h;
bool i;
opaque j;
};
"#,
r#"impl TryFrom<&mut Bytes> for small<Bytes> {
Expand All @@ -469,12 +470,13 @@ Ok(small {
a: v.read_u32()?,
b: v.read_u64()?,
c: v.read_i32()?,
d: v.read_i64()?,
e: v.read_f32()?,
f: v.read_f64()?,
g: v.read_string(None)?,
h: v.read_bool()?,
i: v.read_variable_bytes(None)?,
d: v.read_u32()?,
e: v.read_i64()?,
f: v.read_f32()?,
g: v.read_f64()?,
h: v.read_string(None)?,
i: v.read_bool()?,
j: v.read_variable_bytes(None)?,
})
}
}
Expand Down

0 comments on commit a2b869a

Please sign in to comment.