什么用 crate::body::Body;意思?

What does use crate::body::Body; mean?

https://github.com/sdroege/rtsp-server/blob/master/src/listener/message_socket.rs 上,

use crate::body::Body;

我只能找到有关外部包装箱的信息:https://doc.rust-lang.org/reference/items/extern-crates.html

use crate:: 是什么意思?

指的是当前正在编译的crate。所以在这个例子中,它被解析为rtsp_server::body::Bodybody::Body 部分是指 body 模块的 Body struct/enum。

Rust documentation says:

crate is also used to represent the absolute path of a module, where crate refers to the root of the current crate. For instance, crate::foo::bar refers to the name bar inside the module foo, from anywhere else in the same crate.