#[allow(unused_imports)] use super::*;
#[doc(hidden)]
pub trait MachineBuilder {
type InstructionSet: MachineImpl;
fn build_raw<T>(raw: T, channel_capacity: usize) -> (Arc<Mutex<T>>, Sender<Self::InstructionSet>, MachineAdapter)
where
T: 'static + Machine<Self::InstructionSet>,
<Self as MachineBuilder>::InstructionSet: Send;
fn build_addition<T>(machine: &Arc<Mutex<T>>, channel_capacity: usize) -> (Sender<Self::InstructionSet>, MachineAdapter)
where
T: 'static + Machine<Self::InstructionSet>;
fn build_unbounded<T>(raw: T) -> (Arc<Mutex<T>>, Sender<Self::InstructionSet>, MachineAdapter)
where
T: 'static + Machine<Self::InstructionSet>,
<Self as MachineBuilder>::InstructionSet: Send;
fn build_addition_unbounded<T>(machine: &Arc<Mutex<T>>) -> (Sender<Self::InstructionSet>, MachineAdapter)
where
T: 'static + Machine<Self::InstructionSet>,
<Self as MachineBuilder>::InstructionSet: Send;
fn build_common<T>(
raw: T, s: Sender<Self::InstructionSet>, r: Receiver<Self::InstructionSet>,
) -> (Arc<Mutex<T>>, Sender<Self::InstructionSet>, MachineAdapter)
where
T: 'static + Machine<Self::InstructionSet>,
<Self as MachineBuilder>::InstructionSet: Send;
fn build_addition_common<T>(
machine: &Arc<Mutex<T>>, sender: Sender<Self::InstructionSet>, receiver: Receiver<Self::InstructionSet>,
) -> (Sender<Self::InstructionSet>, MachineAdapter)
where
T: 'static + Machine<Self::InstructionSet>;
}
#[inline]
pub fn send_cmd<T>(sender: &Sender<T>, cmd: T)
where
T: MachineImpl + MachineImpl<InstructionSet = T> + std::fmt::Debug,
{
match sender.send(cmd) {
Ok(_) => (),
Err(e) => log::info!("failed to send instruction: {}", e),
}
}