Mapping to Java
The Squared IDL is mapped to Java as follows:
- Primitive types:
i8
,u8
to Javabyte
i16
,u16
to Javashort
i32
,u32
to Javaint
u64
,u64
to Javalong
f32
to Javafloat
f64
to Javadouble
char
to Javau32
(a Javachar
is not a 32-bit unicode code point)
- Collection types map to Java collections:
- A Rust
Vec<T>
to a JavaArrayList<T>
- ...
- A Rust
- Tuples and public structs map to Java classes with public fields
- Enums with associated data map to an abstract Java base class and public-struct-like subclasses for each variant
- Enums map without associated data map to Java enums
- Instances of the class pattern map to Java classes with methods