On 07/01/2012 03:47 PM, Jesse Jones wrote:
I'm confused about how I can structure libraries. Let's say I have a whizbang 
library. It's complex enough that I want whiz and bang submodules, but that's 
just an implementation detail: I'd like clients of the libraries to use the 
public API with just an `import whizbang;`. I had thought something like the 
following would work:

whizbang.rs
    import whiz::*;
    import bang::*;

    export whiz1, whiz2;
    export bang1;

whiz.rs:
    fn whiz1() {}
    fn whiz2() {}

bang.rs:
    fn bang1() {}

And it does work…but only within the whizbang project. whiz.rs, for example, 
can use bang1 without even doing an import. But external libraries have to do 
whizbang::whiz::whiz1.


I would expect this to work as written. core.rs does similar things to expose option::some, none, etc. Perhaps it's because of a resolve bug. core doesn't use `import::*` for example, so maybe reexporting an import star is funky.

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to