Issue
This line is from Rust libc crate. What is the use of double colon here? I thought its bringing c_uint
in the scope from the crate root but I can't find where its defined in the crate root.
pub type speed_t = ::c_uint;
Solution
https://doc.rust-lang.org/reference/paths.html#path-qualifiers
Paths can be denoted with various leading qualifiers to change the meaning of how it is resolved.
::
Paths starting with
::
are considered to be global paths where the segments of the path start being resolved from the crate root. Each identifier in the path must resolve to an item.
So your idea was correct, it is resolving from the crate root.
I can't find where its defined in the crate root.
well libc
doesn't in-and-of-itself define anything at the crate root, instead the crate root re-exports the content of the submodule matching the compilation target.
So on unix the "crate root" contains anything exposed by the fixed_width_ints
and unix
submodules. The former is not really useful for you, but the latter... does define a c_uint
symbol.
Answered By - Masklinn Answer Checked By - Senaida (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.