Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Mapping for Array Types

IDL arrays are mapped to Rust arrays, which allows the definition of statically initialized data.

// IDL
typedef float F[10];
typedef string V[10];
typedef string M[1][2][3];
#![allow(unused)]
fn main() {
// Rust
pub type F = [f32; 10];
pub type V = [String; 10];
pub type M = [[[String; 3]; 2]; 1];
}

Default Value

The default value for an array is an array where each element is initialized to its type’s default value. For example, an array of 10 integers defaults to [0; 10], and an array of strings defaults to an array of empty strings.