aztec-nr - protocol_types::utils::arrays

Function array_length

pub fn array_length<T, let N: u32>(array: [T; N]) -> u32
where T: Empty

Deprecated.

Helper function to count the number of non-empty elements in a validated array. Important: Only use it for validated arrays where validate_array(array) returns true, which ensures that:

  1. All elements before the first empty element are non-empty
  2. All elements after and including the first empty element are empty
  3. The array forms a contiguous sequence of non-empty elements followed by empty elements