Hm, you make a good point: I should probably add a Share bound somwhere in
there...
Am 15.05.2014 13:22 schrieb "Simon Sapin" <[email protected]>:

> On 15/05/2014 08:59, Christophe Pedretti wrote:
>
>> I am trying to implement a Singleton (an object which instantiate only
>> once, successive instantiations returning the object itself).
>> Any tutorial for this ? any idea ? example ? best practice ?
>>
>
> Kimundi published this macro to define lazily initialized statics, which
> look to me equivalent to singletons although there is no "instanciation"
> involved:
>
> https://gist.github.com/Kimundi/8782487
> http://www.reddit.com/r/rust/comments/1wvxcn/lazily_initialized_statics/
>
> I believe this is only memory-safe with types that satisfy the `Share`
> kind.
>
> http://static.rust-lang.org/doc/master/core/kinds/trait.Share.html
>
> --
> Simon Sapin
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to