maplit | Rust container / collection literal macros | Map library
kandi X-RAY | maplit Summary
kandi X-RAY | maplit Summary
Rust container / collection literal macros for HashMap, HashSet, BTreeMap, BTreeSet.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of maplit
maplit Key Features
maplit Examples and Code Snippets
Community Discussions
Trending Discussions on maplit
QUESTION
This maplit crate allows hashmap literals with =>
as a separator. I believe it's impossible to use macro_rules!
to allow the :
separator, but is it possible with a macro that processes a stream of tokens?
Is it impossible to add { key: value }
style macros to the language, even in the compiler?
I suspect the problem is conflict with the :
type operator, but I cannot construct an ambiguous example where it is impossible for the compiler to make a decision of which way to interpret :
.
ANSWER
Answered 2022-Mar-19 at 20:47If you were to replace the =>
with a :
in the maplit!
macro you'd get this error:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install maplit
Rust is installed and managed by the rustup tool. Rust has a 6-week rapid release process and supports a great number of platforms, so there are many builds of Rust available at any time. Please refer rust-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page