Hi Patrick,

2013/4/8 Patrick Walton <[email protected]>

> This is a use case for the `#[nonsendable]` or `#[nonowned]` annotation on
> structs. This annotation isn't implemented yet, but it's a common feature
> request, as it will be needed for non-thread-safe reference-counted smart
> pointers too. With that attribute you could ensure that GObject values can
> only live in one thread at a time.


Good. Meanwhile, I've been looking at using lifetime-bound borrowed
pointers to return wrapped objects. But I have no idea yet how to pass
lifetime to constructors and other non-method functions returning objects.
Also, this will probably not work well with managed boxes.


>
>  Another topic of interest is casting. GObject provides runtime type
>> information and supports dynamic type checks. This means we can safely
>> down- and side-cast between traits representing GObject classes or
>> interfaces, but we need a custom cast implementation. Is there any
>> idiomatic trait to reuse?
>>
>
> There isn't anything in the standard library to do that, but the Rust Core
> Foundation bindings have a system similar to what you're proposing. (CF is
> a GObject-like system.) The trait definitions in `rust-core-foundation` are
> a little complex for my taste though--if you can come up with something
> simpler then I'm all for it.
>

Thanks, I will look into that.

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

Reply via email to