Safe_client_libs , which network?

Hello !

I am playing with safe_client_libs, trying to run the examples against real routing.

examples fail and panick at creating an account, but I suppose I should tell them someway that I want to connect , for instance, to test_12c ? Is it even possible to talk to 12c this way ? In the positive, how would you do that ? I am digging the sources, but I can’t find a place where to configure this.

ty !


ok, I was searching the source, but didn’t look into tagret/debug/examples

self_authenticator.crust.config was here waiting for me :slight_smile:

launching the examples create empty config files, then fail. You just need to fill in the files and launch the example again.

Then examples now work like a charm!


Examples does work indeed. Thanks for the help.

I decided moved to another folder, “safe” so that I could call safe through an app I am building. However, the problem I can’t seem to understand, how do I properly write macro if the macro is defined in a module?

Basically what I done was put an example in src/safe/ Inside src/ file contains,

pub mod safe;

 fn main() {

The error is…

error[E0468]: an `extern crate` loading macros must be at the crate root
  --> src/safe/
47 | extern crate maidsafe_utilities;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

From what I am understanding, is that all of the extern crate need to move to src/

If I move it to file, while leaving the code intact in, then I would get an error, missing macro!

Did you also have the #[macro_use] statement just before that extern crate line?

Just so you know, the rust community is pretty active and helpful so you might get a quicker response for questions like this on #rust. You might have already tried there though.

Thanks for your input.

Yes. I did placed them in the crate root, before the extern crate line. Everything is the same exact copy from the example. All I did was cut, and moved the extern crate to src/ with #[macro_use]

extern crate maidsafe_utilities;
extern crate time;
extern crate routing;
extern crate safe_core;
extern crate unwrap;
extern crate chan;

If I did that, and remove the extern crate from then the code becomes faulty, because it needs those extern crate to express the commands. To understand what I’m talking about, here’s the code..

Do note that there are three different commits, for three different errors…

Latest commit, I re-add the extern crate. Remove macro from crate section, and place it in the function. The error says it is missing macro. I did remove the (unwrap, chan) from `#[macro_use] for more test. Same problem.

Third latest commit states that it is missing extern crate. I added macro to each function, and the error still persistent.

Fourth latest commit states that extern crate must be saved in root.

I guess, I might made this complicated but I’m trying knit it all up together. I’ll do more testing later. Skip the “core” folder. I plan to conjunct both together, once I get safe folder set up properly. Hope that helps a bit.

1 Like

Wow! Thanks for the help!

I noticed you add [lib] and [bin]to the Cargo.toml, and what does this do exactly? Does it get to recognize the sub folders?

You removed Is it because it was conflicting with

Don’t I need, to get app running?

Thanks again!


It seems that I should create inside of /bin/ ?

1 Like

Ah sorry I missed that file, I added now and did a PR to your repo.

Yes the cargo toml structure there allows a bin and lib to exist in the same repo. Otherwise it can get confusing a wee bit, so this is more like ou create teh lib and add in a binary that uses the lib. It keeps it simple I think.

I also renamed safe/ to safe/safe_lib No real reason but it could confuse the compiler, I Am not sure. Usually a mod has some files in that that are all named specifically (bot not same name as mod). Not sure I am too clear there, but hope you get it anyway form my ramblings :slight_smile:

1 Like

Thank you so much!

I didn’t realized it could confuse the compiler. I was throwing stuff together and see how it turns out. You know, like a baby trying fit a block into a circle. That kind of thing.

I hope I’m not making this app too complicated but I think it needs to be this way when I start adding a lot more features into it.


Not at all you are all good there chap :slight_smile: