On Jul 5, 2012, at 10:31 PM, Zack Corr wrote:

> On Fri, Jul 6, 2012 at 11:00 AM, Jesse Jones <[email protected]> wrote:
> 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::*;
> 
> Try something like `import some_object = rrdf::object::some_object;` and then 
> `export some_object`. That sort of thing works for me.

Tried this, but clients couldn't get at the constructors for the object enum. I 
did:

#[doc = "API for the rrdf library."];
import to_str::to_str;
import core::dvec::*;
import std::map::hashmap; 
import std::time::tm;

// This is a convenience for internal modules.
import object::*;
import query::*;
import solution::*;
import store::*;

// These are the exports for clients of rrdf.
// Clients should not use items from other modules.
import object = object::object; export object;

import subject = store::subject; export subject;
import predicate = store::predicate; export predicate;
import triple = store::triple; export triple;
import namespace = store::namespace; export namespace;
import entry = store::entry; export entry;
import extension_fn = store::extension_fn; export extension_fn;
import store = store::store; export store;
import create_store = store::create_store; export create_store;
import make_triple_blank = store::make_triple_blank; export make_triple_blank;
import make_triple_str = store::make_triple_str; export make_triple_str;
import make_triple_uri = store::make_triple_uri; export make_triple_uri;
import get_blank_name = store::get_blank_name; export get_blank_name;

import selector = sparql::selector; export selector;
import compile = sparql::compile; export compile;

import solution_row = solution::solution_row; export solution_row;
import solution = solution::solution; export solution;

And then a client of the library did:

import rrdf::*;

   vec::push(entries, ("snmp:" + name, string_value(*s, "")));

which gave me: "error: unresolved name: string_value".

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

Reply via email to