PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, November 25, 2022

[FIXED] What does use crate::body::Body; mean?

 November 25, 2022     module, rust     No comments   

Issue

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?


Solution

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.



Answered By - Smitop
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing