The most ugly trick in Rust language

Askar Safin (@safinaskar@types.pl).
The most ugly #trick in rust language, which #plt people will completely dislike. Let’s assume we need to write macro a!, which determines whether given expression implements given trait Value. If yes, it should print “Yes”, if no - “No”. Surprisingly, this is possible in Rust. By completely abusing method call expression rules ( Method call expressions - The Rust Reference ). Here is solution: attributes: added missing RecordTypes for instrument by kaffarell · Pull Request #2781 · tokio-rs/tracing · GitHub . I think existence of such trick proves that Rust is not perfect language

Read in full here:

This thread was posted by one of our members via one of our news source trackers.