polyphony-chat / chorus

A Rust library for interacting with multiple Polyphony- and Spacebar-Compatible instances at once.
https://crates.io/crates/chorus
Mozilla Public License 2.0
16 stars 7 forks source link

Replace `Observer` and `GatewayEvent` with `pubserve` crate #524

Closed bitfl0wer closed 2 months ago

bitfl0wer commented 2 months ago

This PR replaces our internal Observer trait with a more generic version, as offered by our pubserve crate.

This also has the added benefit of removing the... creative logic used in Observer::unsubscribe() which did not check the memory the internal Arc points to, but rather some weird

self.observers
            .retain(|obs| format!("{:?}", obs) != to_remove);

which was written ages ago by a version of me that was still at the very beginning of learning Rust