gtk-rs / gtk-rs-core

Rust bindings for GNOME libraries
https://gtk-rs.org/gtk-rs-core
MIT License
272 stars 105 forks source link

gio: Add a method to get a stream of incoming connections to SocketListener #1454

Closed carlosmn closed 1 week ago

carlosmn commented 2 weeks ago

This object provides a Stream over which we can iterate in order to accept connections in an async environment.

This is analogous to the one provided by async-std's TcpListener.

This is an attempt at #1064. As I mention there, I think SocketService is the wrong abstraction to use in async so this is implemented for SocketListener, so that this incoming() is by itself an alternative to SocketService.

The type that we return here feels pretty awkward but it's what this returns. The pattern with the source object feels like another instance of something that makes sense without easy async but with async Rust you'd create multiple objects? But maybe I don't see other use-cases for it here.

carlosmn commented 2 weeks ago

Alright, updated. I think the change in Gir.toml is right, but it's the first time I've had to touch something like that.

carlosmn commented 1 week ago

Well after way too much trial-and-error, this should be good to go now, but I don't understand that "docs embed" check as it seems to be about some bit flags.

sdroege commented 1 week ago

but I don't understand that "docs embed" check as it seems to be about some bit flags.

There's something broken with that check. Every now and then it reports errors like this for no reason.