diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /third_party/rust/midir/src/os | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/midir/src/os')
-rw-r--r-- | third_party/rust/midir/src/os/mod.rs | 1 | ||||
-rw-r--r-- | third_party/rust/midir/src/os/unix.rs | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/third_party/rust/midir/src/os/mod.rs b/third_party/rust/midir/src/os/mod.rs new file mode 100644 index 0000000000..70ff75cd9d --- /dev/null +++ b/third_party/rust/midir/src/os/mod.rs @@ -0,0 +1 @@ +#[cfg(unix)] pub mod unix;
\ No newline at end of file diff --git a/third_party/rust/midir/src/os/unix.rs b/third_party/rust/midir/src/os/unix.rs new file mode 100644 index 0000000000..88dcfee1d9 --- /dev/null +++ b/third_party/rust/midir/src/os/unix.rs @@ -0,0 +1,27 @@ +use ::ConnectError; +use ::{MidiInputConnection, MidiOutputConnection}; + +// TODO: maybe move to module `virtual` instead of `os::unix`? + +/// Trait that is implemented by `MidiInput` on platforms that +/// support virtual ports (currently every platform but Windows). +pub trait VirtualInput<T: Send> where Self: Sized { + /// Creates a virtual input port. Once it has been created, + /// other applications can connect to this port and send MIDI + /// messages which will be received by this port. + fn create_virtual<F>( + self, port_name: &str, callback: F, data: T + ) -> Result<MidiInputConnection<T>, ConnectError<Self>> + where F: FnMut(u64, &[u8], &mut T) + Send + 'static; +} + +/// Trait that is implemented by `MidiOutput` on platforms that +/// support virtual ports (currently every platform but Windows). +pub trait VirtualOutput where Self: Sized { + /// Creates a virtual output port. Once it has been created, + /// other applications can connect to this port and will + /// receive MIDI messages that are sent to this port. + fn create_virtual( + self, port_name: &str + ) -> Result<MidiOutputConnection, ConnectError<Self>>; +}
\ No newline at end of file |