Struct firebase_rs::Firebase
source · [−]pub struct Firebase { /* private fields */ }
Implementations
sourceimpl Firebase
impl Firebase
sourcepub fn new(uri: &str) -> Result<Self, UrlParseError> where
Self: Sized,
pub fn new(uri: &str) -> Result<Self, UrlParseError> where
Self: Sized,
use firebase_rs::Firebase;
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap();
sourcepub fn auth(uri: &str, auth_key: &str) -> Result<Self, UrlParseError> where
Self: Sized,
pub fn auth(uri: &str, auth_key: &str) -> Result<Self, UrlParseError> where
Self: Sized,
use firebase_rs::Firebase;
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap();
sourcepub fn with_params(&self) -> Params
pub fn with_params(&self) -> Params
use firebase_rs::Firebase;
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().with_params().start_at(1).order_by("name").equal_to(5).finish();
let result = firebase.get::<String>().await;
sourcepub fn at(&mut self, path: &str) -> Self
pub fn at(&mut self, path: &str) -> Self
use firebase_rs::Firebase;
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users").at("USER_ID").at("f69111a8a5258c15286d3d0bd4688c55");
sourcepub fn get_uri(&self) -> String
pub fn get_uri(&self) -> String
use firebase_rs::Firebase;
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users");
let uri = firebase.get_uri();
sourcepub async fn set<T>(&self, data: &T) -> Result<Response, RequestError> where
T: Serialize + DeserializeOwned + Debug,
pub async fn set<T>(&self, data: &T) -> Result<Response, RequestError> where
T: Serialize + DeserializeOwned + Debug,
use firebase_rs::Firebase;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug)]
struct User {
name: String
}
let user = User { name: String::default() };
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users");
let users = firebase.set(&user).await;
sourcepub async fn get_as_string(&self) -> Result<Response, RequestError>
pub async fn get_as_string(&self) -> Result<Response, RequestError>
use std::collections::HashMap;
use firebase_rs::Firebase;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug)]
struct User {
name: String
}
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users");
let users = firebase.get::<HashMap<String, User>>().await;
sourcepub async fn get<T>(&self) -> Result<T, RequestError> where
T: Serialize + DeserializeOwned + Debug,
pub async fn get<T>(&self) -> Result<T, RequestError> where
T: Serialize + DeserializeOwned + Debug,
use std::collections::HashMap;
use firebase_rs::Firebase;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug)]
struct User {
name: String
}
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users").at("USER_ID");
let user = firebase.get::<User>().await;
// OR
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users");
let user = firebase.get::<HashMap<String, User>>().await;
sourcepub async fn delete(&self) -> Result<Response, RequestError>
pub async fn delete(&self) -> Result<Response, RequestError>
use firebase_rs::Firebase;
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users").at("USER_ID");
firebase.delete().await;
sourcepub async fn update<T>(&self, data: &T) -> Result<Response, RequestError> where
T: DeserializeOwned + Serialize + Debug,
pub async fn update<T>(&self, data: &T) -> Result<Response, RequestError> where
T: DeserializeOwned + Serialize + Debug,
use firebase_rs::Firebase;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug)]
struct User {
name: String
}
let user = User { name: String::default() };
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users").at("USER_ID");
let users = firebase.update(&user).await;
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Firebase
impl Send for Firebase
impl Sync for Firebase
impl Unpin for Firebase
impl UnwindSafe for Firebase
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more