Skip to content

Fixed size arrays #5475

@ArielElp

Description

@ArielElp

Introducing the fixed size array type to the language:

let arr1: [u64; 5] = [1,2,3,4,5];
let arr2: Span<u64> = [1,2,3,4,5].span();

In addition, we'll have the capability of defining const fixed size array, which are analogous to dw in CairoZero:

const arr: [u64; 5] = [1,2,3,4,5];

To pass the const value cheaply between functions (without copying), you should pass box as follows:

fn get_arr(arr: Box<[u64; 5]>) { ... }

get_arr(BoxTrait::new(arr));

Metadata

Metadata

Assignees

No one assigned

    Labels

    mediumroadmapa feature included in the public roadmap

    Type

    No type

    Projects

    Status

    v2.7.0

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions