Vec literals
See original GitHub issueNow that a new literal framework is in place after #820, would it make sense to create a mechanism (possibly by co-opting VecInit
or by creating a VecLit
constructor) to create Vec literals? The current closest equivalent, VecInit,
still creates a wire and assigns the literals to it the old way we worked around lack of bundle literals.
Type of issue: feature request
Impact: no functional change | API addition (no impact on existing code)
Development Phase: request | proposal
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:13 (12 by maintainers)
Top Results From Across the Web
Create Vec<String> from literal - rust - Stack Overflow
You can get an iterator from a Vec by calling Vec::iter or into_iter : fn main() { let options: Vec<String> = vec!
Read more >Vec literals · Issue #849 · chipsalliance/chisel3 - GitHub
VecInit is a useful shorthand for packing elements into a Vec, but can't be used in Bundle literal constructors. Bundle literal constructors ...
Read more >Vec in std::vec - Rust
A contiguous growable array type, written as `Vec `, short for 'vector'.
Read more >Bundles and Vecs - Chisel/FIRRTL
Bundle and Vec are classes that allow the user to expand the set of ... You can create literal Bundles using the experimental...
Read more >Vector
Vectors of any type can be created with vector literals. ... Note that Vector::destroy_empty will abort at runtime unless vec contains zero elements:....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d disagree. I can’t think of any language off the top of my head which requires over-specification like that (both explicitly the number of elements, and implicitly as the size of the argument list). Even C allows something like
int arr[] = {0, 1, 2};
(though you could also explicitly specify the array length if you wanted to). This style also becomes a maintenance burden, as if you have a mismatch, you might not notice until you get a runtime error.There is a PR 🙂 : https://github.com/chipsalliance/chisel3/pull/1793