[rust-dev] Library organization

Jesse Jones jesse9jones at gmail.com
Thu Jul 5 18:00:23 PDT 2012

I didn't mean to do a private reply: my email client does that by default and I don't always remember to fix the reply address.

As far as my problem goes I think it's something you guys have a handle on. But to be clear, what I want to do is write a library with a public API yet have the freedom to physically structure the library however I want. So I want clients to be able to pull in the public API with a single import even if the items were defined in different modules. And this did not work: clients of my library had to use multiple imports.

Here is the actual library code where I re-export the public API: https://github.com/jesse99/rrdf/blob/master/src/rrdf.rs. The thought was that clients could then do `import rrdf::*;` but what they have to do instead is crap like:
import rrdf::object::*;
import rrdf::store::*;

  -- Jesse

On Jul 5, 2012, at 1:55 PM, Graydon Hoare wrote:

> On 12-07-03 5:45 PM, Jesse Jones wrote:
>> I know about the distinction between use and import, and I do have a `use whiz bang`. And I can use my library. It's just more inconvenient than I'd like: I have to use 3+ imports to access the public API.
> Ok. Sorry to sound obtuse, but I'm not sure what it is you'd prefer to be writing (nor where these 3 imports are occurring in your client code). The initial report made it sound like something was literally not working; if this is an aesthetic-preference thing, that's a different sort of issue, but maybe we can make some headway on that too.
> Can you write down "what you have to write now" to make it work, and "what you'd prefer to be writing"? Even if it's sort of wish-list-y?
> (Replying to you privately as you replied in private; though this is perfectly fine to discuss on the list and I'm happy to do it there, if that was unintentional.)
> -Graydon

More information about the Rust-dev mailing list