Is this the best way to send a `Vec<u8>` of pixels to Sciter as image bytes?
GirkovArpa opened this issue · 3 comments
GirkovArpa commented
Briefly, here is what I'm doing which works:
use sciter_serde::{to_value};
use serde_bytes::Bytes;
let bytes: Vec<u8> = my_image_magick_function();
let output = to_value(&Bytes::new(&bytes));
done.call(None, &make_args!(output), None).unwrap()
function onDone(imageBytes) {
$(img).value = Image.fromBytes(imageBytes);
}
I don't want to perform any unnecessary serialization step, so is there a better way?
pravic commented
GirkovArpa commented
I get this error:
expected an
Fn<(&[Value],)>
closure, foundVec<u8>
GirkovArpa commented
Solved:
Value::from(&bytes[..])