lumol-org / soa-derive

Array of Struct to Struct of Array helpers in Rust
Apache License 2.0
416 stars 28 forks source link

Vector's iter method is private for non public structs #69

Open akhilman opened 4 hours ago

akhilman commented 4 hours ago

I have an error:

error[E0624]: method `iter` is private
  --> src/main.rs:12:10
   |
3  | #[derive(Debug, StructOfArray)]
   |                 ------------- private method defined here
...
12 |     mega.iter().for_each(|row| {
   |          ^^^^ private method

In this code:

use soa_derive::StructOfArray;

#[derive(Debug, StructOfArray)]
#[soa_derive(Debug)]
struct MegaStruct {
    foo: usize,
    bar: usize,
}

fn main() {
    let mega = MegaStructVec::default();
    mega.iter().for_each(|row| {
        println!("{:?}", row);
    });
}

What I am doing wrong?

akhilman commented 3 hours ago

Ok. Fount a cause. The struct should be public to make iter accessible.