pub trait Request {
// Required methods
fn result(&self) -> Result<JsValue, Error>;
fn error(&self) -> Result<Option<DomException>, Error>;
fn source(&self) -> Result<Object, Error>;
fn transaction(&self) -> Option<Transaction>;
fn ready_state(&self) -> Result<RequestReadyState, Error>;
fn on_success<F>(&mut self, callback: F)
where F: FnOnce(Event) + 'static;
fn on_error<F>(&mut self, callback: F)
where F: FnOnce(Event) + 'static;
}Expand description
Specifies all the functions supported by request objects.
Required Methods§
Sourcefn result(&self) -> Result<JsValue, Error>
fn result(&self) -> Result<JsValue, Error>
When a request is completed, returns the result, or undefined if the request failed. Returns an Error if
the request is still pending.
Sourcefn error(&self) -> Result<Option<DomException>, Error>
fn error(&self) -> Result<Option<DomException>, Error>
When a request is completed, returns the error (a DOMException), or None if the request succeeded. Returns
an Error if the request is still pending.
Sourcefn source(&self) -> Result<Object, Error>
fn source(&self) -> Result<Object, Error>
Returns the ObjectStore, Index, or Cursor the request was made against, or null if it was an open
request.
Sourcefn transaction(&self) -> Option<Transaction>
fn transaction(&self) -> Option<Transaction>
Returns the Transaction the request was made within. If this as an open request, then it returns an upgrade
transaction while it is running, or None otherwise.
Sourcefn ready_state(&self) -> Result<RequestReadyState, Error>
fn ready_state(&self) -> Result<RequestReadyState, Error>
Returns RequestReadyState::Pending until a request is complete, then returns RequestReadyState::Done.
Sourcefn on_success<F>(&mut self, callback: F)
fn on_success<F>(&mut self, callback: F)
Adds an event handler for success event.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.