Why does this Rust import need `self`? -


i have following set of imports @ top of program:

extern crate serde_bencode; extern crate serde; extern crate serde_bytes; extern crate url; extern crate url_serde;  use serde_bytes::bytebuf; use serde_bencode::de; use serde_bencode::error::result; use serde_bencode::error::{custom, invalidlength}; use self::url::{url}; 

this program does compile. however, don't understand why need write self on use self::url::{url}; line. none of other use statements need self - why url?

for context, snippet above file called file_reader.rs, in directory following structure:

roar/     file_reader.rs     main.rs     lib.rs 

edit: noticed if add line extern crate url; lib.rs, don't need self; however, don't know why step necessary.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -