Question about initializing a GenericArray

I have the following rust code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=2c8e3c861b65087ef656bc0c80670fda

I'm asking about line 35, and what other options I have for initializing the array of packets?

You can use clone_from_slice or from_exact_iter, if you know the array length you can use convert arrays into generic array (up to size 32) or the arr macro. But for what you are asking, using generate is probably the best way.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.