bilelmoussaoui / oo7

James Bond went on a new mission as a Secret Service provider
https://bilelmoussaoui.github.io/oo7/oo7/
MIT License
57 stars 11 forks source link

Connecting to SecretService signals #57

Closed sophie-h closed 6 months ago

sophie-h commented 6 months ago

I would like to connect to secret service signals. With what we have the naive implementation would probably look like

    pub async fn receive_item_changed(
        &self,
    ) -> Result<impl futures_util::Stream<Item = Item<'_>>, Error> {
        self.inner.receive_item_changed().await.map(|stream| {
            stream.map(|item| {
                Item::new(
                    Arc::clone(&self.service),
                    Arc::clone(&self.session),
                    self.algorithm,
                    item,
                    self.aes_key.as_ref().map(Arc::clone),
                )
            })
        })
    }

However, oo7 only deals with Item<'static> which we don't get here. I think it's a zbus limitation at the moment.

To work around this, I would like to add Collection::item_for_path and Item::path functions, since together they would allow us to get a static version of the item.

Any thoughts? Otherwise, I would implement this.

bilelmoussaoui commented 6 months ago

However, oo7 only deals with Item<'static> which we don't get here. I think it's a zbus limitation at the moment.

What do you mean by oo7 only dealing with Item<'static>?

To work around this, I would like to add Collection::item_for_path

What would such function do?

and Item::path functions

I would implement Deref for zbus::Proxy on all the dbus::api types.

sophie-h commented 6 months ago

Found the lifetime issue in the existing code. Tried to add all explanations to the commit messages.