Skip to content

Commit

Permalink
chore: rm dead internal IdbRequestLike trait
Browse files Browse the repository at this point in the history
  • Loading branch information
Alorel committed Jul 26, 2024
1 parent 1d46ffa commit 25bfcbd
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions src/request/request_like.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
use wasm_bindgen::prelude::*;
use web_sys::{DomException, IdbOpenDbRequest, IdbRequest, IdbRequestReadyState};

use crate::idb_database::IdbVersionChangeEvent;

pub(crate) trait IdbRequestLike {
fn get_error(&self) -> Result<Option<DomException>, JsValue>;
fn get_result(&self) -> Result<JsValue, JsValue>;
fn set_on_error(&self, value: Option<&::js_sys::Function>);
fn set_on_success(&self, value: Option<&::js_sys::Function>);
fn get_ready_state(&self) -> IdbRequestReadyState;
}

/// Common trait for `IdbOpenDbRequest`s
pub trait IdbOpenDbRequestLike {
/// Set the callback for the `upgradeneeded` event
Expand All @@ -23,37 +14,3 @@ pub trait IdbOpenDbRequestLike {
where
F: Fn(&IdbVersionChangeEvent) -> Result<(), JsValue> + 'static;
}

macro_rules! impl_request_like {
($tgt: ident) => {
impl IdbRequestLike for $tgt {
#[inline]
fn set_on_error(&self, value: Option<&::js_sys::Function>) {
self.set_onerror(value)
}

#[inline]
fn get_ready_state(&self) -> web_sys::IdbRequestReadyState {
self.ready_state()
}

#[inline]
fn set_on_success(&self, value: Option<&::js_sys::Function>) {
self.set_onsuccess(value)
}

#[inline]
fn get_error(&self) -> Result<Option<DomException>, JsValue> {
self.error()
}

#[inline]
fn get_result(&self) -> Result<JsValue, JsValue> {
self.result()
}
}
};
}

impl_request_like!(IdbRequest);
impl_request_like!(IdbOpenDbRequest);

0 comments on commit 25bfcbd

Please sign in to comment.