firebase_wasm/
lib.rs

1//! This crate provides bindings to the Firebase v9 JS SDK.
2//!
3//! There is much to do, and I am only sharing it this early in
4//! the hopes that someone might help me generate the remaining
5//! API surface. At the bare minimum, a 1:1 API should exist,
6//! though idomatic rust wrappers and utilities should exist.
7//! A good example of this can be found in the [`UploadTask`](storage::UploadTask)
8//! struct, which is a helpful wrapper for converting upload tasks into
9//! rust [`streams`](futures::Stream).
10
11#![feature(unboxed_closures, fn_traits)]
12
13#[macro_use]
14extern crate clone_macro;
15#[allow(unused_imports)]
16#[macro_use]
17extern crate tracing;
18#[macro_use]
19extern crate typed_builder;
20
21#[macro_use]
22mod utils;
23pub mod auth;
24pub mod firestore;
25pub mod functions;
26pub mod storage;
27
28use std::{error::Error, fmt};
29
30use wasm_bindgen::prelude::*;
31
32impl fmt::Display for FirebaseError {
33    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
34        self.message().fmt(f)
35    }
36}
37
38impl Error for FirebaseError {}
39
40#[wasm_bindgen]
41extern "C" {
42    #[derive(Clone, Debug)]
43    pub type FirebaseError;
44
45    #[wasm_bindgen(method, getter)]
46    pub fn code(this: &FirebaseError) -> String;
47
48    #[wasm_bindgen(method, getter)]
49    pub fn message(this: &FirebaseError) -> String;
50}