问题标签 [rust-2018]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
rust - 如何转换选项中的内部值?
我有一个Option
包含一些 JSON 的。如果是Some
,则必须转换内部 JSON,但如果是None
,则必须保留None
。
这就是我目前实现的方式:
我是 Rust 新手,并没有完全了解何时使用或何时使用运算match
符的复杂性。if let
?
我的实现是惯用的 Rust 吗?这对我来说似乎相当冗长,并且看起来像一个到处都会出现的模式,所以我可以想象这可以更简洁地处理;是这样吗?
windows - 检查文件是否是 Windows 上 Rust 2018 中的符号链接
我正在为自己编写一个小实用程序,它需要能够检查文件是否是符号链接。
FileType::is_symlink
在 Windows 上使用总是返回false
(适用于目录的符号链接和常规文件)。
使用常规的 Rust 2018 版本,有什么方法可以检查文件是否是 Windows 上的符号链接?
在我的搜索中,我遇到了:FileTypeExt
- 但是据我所知,这需要你使用不稳定的 Rust。
rust - Can Rust macros be shared across editions?
Say a Rust 2018 macro defines an async
function inside it. The syntax it would use would be incompatible with Rust 2015. So if you're compiling your crate with 2015 edition, wouldn't this expanded code from the macro conflict with that?
I'm not that familiar with inner workings of either procedural or declarative macros, but I imagine they need to produce edition-specific code, because their output is going to be treated the same as the rest of the code. If so, how can I share macro exports across edition boundaries. Do I need to re-write them on a per-edition basis? That doesn't seem scalable especially if editions are supposed to be released every 3 years or so.