This repository has been archived on 2026-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
rusty_midi_commander/src/commands.rs

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
);
}
}