Skip to content

Commit b475065

Browse files
committed
fix: cargo feature matrix
1 parent 3bf2c69 commit b475065

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/future/request/listeners.rs

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use super::super::traits::*;
2-
use crate::{cursor::CursorSys, error::UnexpectedDataError};
2+
use crate::error::UnexpectedDataError;
3+
use cfg_if::cfg_if;
34
use std::task::{Context, Poll};
45
use tokio::sync::mpsc;
56
use wasm_bindgen::prelude::*;
@@ -11,7 +12,8 @@ pub enum EventTargetResult {
1112
/// the event.target.result was null
1213
Null,
1314
/// the event.target.result was a [`web_sys::IdbCursor`] instance
14-
Cursor(CursorSys),
15+
#[cfg(feature = "cursors")]
16+
Cursor(crate::cursor::CursorSys),
1517
/// the event.target.result was not null
1618
NotNull,
1719
}
@@ -37,10 +39,18 @@ impl Listeners {
3739

3840
let _ = tx.try_send(match non_null_result {
3941
None => EventTargetResult::Null,
40-
Some(val) => match val.dyn_into::<CursorSys>() {
41-
Ok(cursor) => EventTargetResult::Cursor(cursor),
42-
Err(_) => EventTargetResult::NotNull,
43-
},
42+
Some(val) => {
43+
cfg_if! {
44+
if #[cfg(feature = "cursors")] {
45+
match val.dyn_into::<crate::cursor::CursorSys>() {
46+
Ok(cursor) => EventTargetResult::Cursor(cursor),
47+
Err(_) => EventTargetResult::NotNull,
48+
}
49+
} else {
50+
EventTargetResult::NotNull
51+
}
52+
}
53+
}
4454
});
4555
}));
4656

0 commit comments

Comments
 (0)