tek/src/core.rs

45 lines
1.3 KiB
Rust

pub use std::error::Error;
pub use std::io::{stdout, Stdout, Write};
pub use std::thread::{spawn, JoinHandle};
pub use std::time::Duration;
pub use std::collections::BTreeMap;
pub use std::sync::{Arc, Mutex, MutexGuard};
pub use std::sync::atomic::{Ordering, AtomicBool, AtomicUsize};
pub use std::sync::mpsc::{channel, Sender, Receiver};
pub use microxdg::XdgApp;
pub use ratatui::prelude::*;
pub use midly::{MidiMessage, live::LiveEvent, num::u7};
pub use crossterm::{ExecutableCommand, QueueableCommand};
pub use crossterm::event::{Event, KeyEvent, KeyCode, KeyModifiers};
macro_rules! submod { ($($name:ident)*) => { $(mod $name; pub use self::$name::*;)* }; }
submod!( handle jack keymap midi port render run time );
pub type Usually<T> = Result<T, Box<dyn Error>>;
pub trait Component: Render + Handle {}
impl<T: Render + Handle> Component for T {}
/// A UI component that may have presence on the JACK grap.
pub trait Device: Render + Handle + Process + Send + Sync {
fn boxed (self) -> Box<dyn Device> where Self: Sized + 'static {
Box::new(self)
}
}
/// All things that implement the required traits can be treated as `Device`.
impl<T: Render + Handle + Process + Send + Sync> Device for T {}
// Reexport macros:
pub use crate::{
render,
handle,
process,
phrase,
keymap,
key,
ports
};