Trait midi2::TryRebufferFrom
source · pub trait TryRebufferFrom<T>: Sized {
// Required method
fn try_rebuffer_from(value: T) -> Result<Self, BufferOverflow>;
}
Expand description
Attempt to convert a generic message from one buffer specialisation to another.
The conversion may fail with a BufferOverflow error if the target message representation does not fit all of the message data.
use midi2::{TryRebufferFrom, sysex7::Sysex7};
let borrowed: Sysex7<&[u32]> = Sysex7::try_from(&[
0x3016_0001,
0x0203_0405,
0x3035_0607,
0x0809_0A00,
][..]).expect("Valid data");
assert!(Sysex7::<[u32; 4]>::try_rebuffer_from(borrowed.clone()).is_ok());
assert!(Sysex7::<[u32; 2]>::try_rebuffer_from(borrowed.clone()).is_err());
Required Methods§
fn try_rebuffer_from(value: T) -> Result<Self, BufferOverflow>
Object Safety§
This trait is not object safe.