On 10/10/2013 06:33 PM, Andrei de Araújo Formiga wrote:
(hit send by mistake)

Maybe I'm misunderstanding something, but you don't need to put
everything inside the private module. There's even an example in the
manual that does something like this:

// this is the crate root
mod internal
{
    pub fn internal_1() { }
}

pub mod external
{
    // public functions here will be available outside the crate

    use internal; // pub functions in internal are now usable here

    pub fn pub_api_1() { internal::internal_1() }
}

The external API may need to access private implementation. Writing an internal API just so that the external API can access that implementation seems even more disruptive than sticking everything into a private module. E.g. in my example you'd have to write an accessor for the member m of struct S.

-SL

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

Reply via email to