Skip to content

Commit 4ff030f

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

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/future/request/listeners.rs

Lines changed: 17 additions & 6 deletions
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,19 @@ 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+
#[cfg_attr(not(feature = "cursors"), expect(unused_variables))]
43+
Some(val) => {
44+
cfg_if! {
45+
if #[cfg(feature = "cursors")] {
46+
match val.dyn_into::<crate::cursor::CursorSys>() {
47+
Ok(cursor) => EventTargetResult::Cursor(cursor),
48+
Err(_) => EventTargetResult::NotNull,
49+
}
50+
} else {
51+
EventTargetResult::NotNull
52+
}
53+
}
54+
}
4455
});
4556
}));
4657

0 commit comments

Comments
 (0)