8

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

use crate::body::Body;

I could only find information about external crates: https://doc.rust-lang.org/reference/items/extern-crates.html

What does use crate:: mean?

1

1 Answer 1

11

It refers to to the crate currently being compiled. So in this example, it is resolved as rtsp_server::body::Body. The body::Body part is refering to the Body item in the body module.

The 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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.