33 lines
802 B
Rust
33 lines
802 B
Rust
// The commands module should define the commands that the program can send.
|
|
// This module should provide functions to send each command asynchronously.
|
|
// The functions should return immediately, without waiting for the command to complete.
|
|
|
|
struct MidiData {
|
|
// Define your MIDI data struct here
|
|
}
|
|
|
|
trait Command {
|
|
fn execute(&self, midi_data: &MidiData);
|
|
}
|
|
|
|
struct CommandA;
|
|
|
|
impl Command for CommandA {
|
|
fn execute(&self, midi_data: &MidiData) {
|
|
println!("Executing CommandA with MIDI data {:?}", midi_data);
|
|
}
|
|
}
|
|
|
|
struct CommandB {
|
|
message: String,
|
|
}
|
|
|
|
impl Command for CommandB {
|
|
fn execute(&self, midi_data: &MidiData) {
|
|
println!(
|
|
"Executing CommandB with message '{}' and MIDI data {:?}",
|
|
self.message, midi_data
|
|
);
|
|
}
|
|
}
|