Question for @rustlang folks: is it impossible to use pub(crate) to emulate abstract classes? I've used facade modules successfully for it.
-
-
Replying to @littlecalculist @rustlang
In particular I can have `pub trait Public: Private` where Public is reexported but Private is not. If refactored to pub(crate), rustc error
2 replies 0 retweets 0 likes -
Replying to @littlecalculist @rustlang
Put the private super trait in an inner pub module that doesn't get re-exported. https://github.com/carllerche/http/blob/master/src/header/map.rs#L3111 …
1 reply 0 retweets 0 likes -
Replying to @seanmonstar @rustlang
Doesn't this mean a whole dup hierarchy? That's what I've been doing and I was hoping I didn't have to. 2x the # of modules is
2 replies 0 retweets 0 likes -
Replying to @littlecalculist @rustlang
Nothing should be duplicated. The http crate might seem complicated, but can just put your Sealed trait in an inner module, and that's it.
1 reply 0 retweets 0 likes -
-
Replying to @littlecalculist @rustlang
It has to be, but you never export it from the outer module, so the world never sees it.
1 reply 0 retweets 0 likes -
Replying to @seanmonstar @rustlang
Hm, how you can have an inner pub trait that isn't exported from the crate? If the containing module is pub isn't it reachable?
1 reply 0 retweets 0 likes -
Inner pub module I mean, sorrry
1 reply 0 retweets 0 likes
No, inner module stays private. The trait inside is pub, so compiler is happy. Only person who can see inner mod and trait is that outer mod
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.