libbpf-rs icon indicating copy to clipboard operation
libbpf-rs copied to clipboard

Used contained value's default for Arrays when implementing Default

Open uepoch opened this issue 3 years ago • 0 comments

This makes sure that the type identifier contained in the array is constructed with a valid default.

Since we were hardcoding ::default() after the type identifier, it was not working well with nested arrays

Example:

  uint8_t pcomms[5][16];

Would fail because

[[u8; 16]::default(); 5]

is invalid.

This would turn the impl in:

[[u8::default; 16]; 5]

It's a fairly minor change that should not impact the majority of types

uepoch avatar Aug 11 '22 19:08 uepoch