use crate::Instrument;
use lookit::Lookit;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
#[derive(Debug)]
pub struct Connector(Lookit);
impl Default for Connector {
fn default() -> Self {
Self::new()
}
}
impl Connector {
pub fn new() -> Self {
Self(Lookit::with_midi())
}
}
impl Future for Connector {
type Output = Instrument;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let a = Pin::new(&mut self.as_mut().0)
.poll(cx)
.map(Instrument::new);
match a {
Poll::Ready(Some(x)) => Poll::Ready(x),
Poll::Ready(None) => self.poll(cx),
Poll::Pending => Poll::Pending,
}
}
}