在当前范围内没有为 struct uuid::Uuid 找到名为 new_v3 的函数或关联项

Grv*_*agi 3 rust

我需要在我的结构之一中添加 uuid。我找到了一箱uuid支持。我将依赖添加到我的 Cargo.toml

uuid = "0.8.1"
Run Code Online (Sandbox Code Playgroud)

它下载得很好,但我无法使用该功能Uuid::new_v3()。我收到错误:no function or associated item named new_v3 found for struct uuid::Uuid in the current scope。

对我来说奇怪的部分是我可以使用其中的一些,就像from_slice工作正常一样。

Max*_*axV 5

您必须明确指定您打算使用的 uuid 功能。

您可以new_v3通过添加这样的v3功能来添加支持:

uuid = { version = "0.8", features = ["v3"] }
Run Code Online (Sandbox Code Playgroud)

可以在那里找到更多信息