topiary_tree_sitter_facade/
query_cursor.rs

1#[cfg(not(target_arch = "wasm32"))]
2mod native {
3    pub struct QueryCursor {
4        pub(crate) inner: tree_sitter::QueryCursor,
5    }
6
7    impl QueryCursor {
8        #[inline]
9        pub fn new() -> Self {
10            let inner = tree_sitter::QueryCursor::new();
11            Self { inner }
12        }
13    }
14
15    impl Default for QueryCursor {
16        fn default() -> Self {
17            Self::new()
18        }
19    }
20
21    impl From<tree_sitter::QueryCursor> for QueryCursor {
22        #[inline]
23        fn from(inner: tree_sitter::QueryCursor) -> Self {
24            Self { inner }
25        }
26    }
27
28    impl std::panic::RefUnwindSafe for QueryCursor {}
29
30    impl Unpin for QueryCursor {}
31
32    impl std::panic::UnwindSafe for QueryCursor {}
33}
34
35#[cfg(not(target_arch = "wasm32"))]
36pub use native::*;
37
38#[cfg(target_arch = "wasm32")]
39mod wasm {
40    #[derive(Clone)]
41    pub struct QueryCursor {}
42
43    impl QueryCursor {
44        #[inline]
45        pub fn new() -> Self {
46            Self {}
47        }
48    }
49
50    impl Default for QueryCursor {
51        fn default() -> Self {
52            Self::new()
53        }
54    }
55
56    impl std::panic::RefUnwindSafe for QueryCursor {}
57
58    impl Unpin for QueryCursor {}
59
60    impl std::panic::UnwindSafe for QueryCursor {}
61}
62
63#[cfg(target_arch = "wasm32")]
64pub use wasm::*;