Use collect instead of from iter
This commit is contained in:
parent
0a23b786b0
commit
67439c1c49
@ -79,7 +79,6 @@ pub struct QrGuard {
|
|||||||
|
|
||||||
impl QrGuard {
|
impl QrGuard {
|
||||||
fn new(code: &str) -> Self {
|
fn new(code: &str) -> Self {
|
||||||
use std::iter::FromIterator;
|
|
||||||
log!("Generating new QrCode");
|
log!("Generating new QrCode");
|
||||||
let svg = generate_qr_from_code(code);
|
let svg = generate_qr_from_code(code);
|
||||||
|
|
||||||
@ -89,7 +88,7 @@ impl QrGuard {
|
|||||||
|
|
||||||
let png_jsarray: JsValue = js_sys::Uint8Array::from(&png_vec[..]).into();
|
let png_jsarray: JsValue = js_sys::Uint8Array::from(&png_vec[..]).into();
|
||||||
// the buffer has to be an array of arrays
|
// the buffer has to be an array of arrays
|
||||||
let png_buffer = js_sys::Array::from_iter(std::array::IntoIter::new([png_jsarray]));
|
let png_buffer: js_sys::Array = std::array::IntoIter::new([png_jsarray]).collect();
|
||||||
let png_blob =
|
let png_blob =
|
||||||
web_sys::Blob::new_with_buffer_source_sequence_and_options(&png_buffer, &properties)
|
web_sys::Blob::new_with_buffer_source_sequence_and_options(&png_buffer, &properties)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user