update iced

This commit is contained in:
Ashley Wulber 2024-10-30 22:51:08 -04:00 committed by Ashley Wulber
parent 11faa567f3
commit 5b5cd77e7c
45 changed files with 2360 additions and 1537 deletions

View file

@ -9,10 +9,13 @@ use bluer::{
Adapter, Address, Session, Uuid,
};
use cosmic::iced::{
self,
futures::{SinkExt, StreamExt},
subscription,
use cosmic::{
iced::{
self,
futures::{SinkExt, StreamExt},
Subscription,
},
iced_futures::stream,
};
use rand::Rng;
@ -29,13 +32,16 @@ use tokio::{
pub fn bluetooth_subscription<I: 'static + Hash + Copy + Send + Sync + Debug>(
id: I,
) -> iced::Subscription<BluerEvent> {
subscription::channel(id, 50, move |mut output| async move {
let mut state = State::Ready;
Subscription::run_with_id(
id,
stream::channel(50, move |mut output| async move {
let mut state = State::Ready;
loop {
state = start_listening(state, &mut output).await;
}
})
loop {
state = start_listening(state, &mut output).await;
}
}),
)
}
pub enum State {