Why does this Rust import need `self`? -
this question has answer here:
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
Post a Comment