pub fn i_buffer_to_vec(i_buffer: IBuffer) -> Result<Vec<u8>, Error>Expand description
Convert [IBuffer] to Vec<u8>.
ยงExamples
use windows::Storage::Streams::DataWriter;
use ble_data_struct::windows::buffer::i_buffer_to_vec;
let data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].to_vec();
let data_writer = DataWriter::new().unwrap();
data_writer.WriteBytes(&data).unwrap();
let buffer = data_writer.DetachBuffer().unwrap();
let result = i_buffer_to_vec(buffer);
assert!(result.is_ok());
assert_eq!(data.to_vec(), result.unwrap());