pub struct Firebase { /* private fields */ }
Expand description

A Firebase instance to manage data.

Implementations

Creates a new Firebase instance from the url of the fb server The url should be a valid HTTPS url, anything else will result in an error:

https://docs-examples.firebaseio.com/

Failures
  • If a url is not specified with the HTTPS scheme, a Err(ParseError::UrlIsNotHTTPS) will be returned.
  • If a url cannot be parsed into a valid url then a Err(ParseError::Parser(url::ParseError) will be returned.

Creates a firebase reference from a borrow of a Url instance.

Failures
  • If a url is not specified with the HTTPS scheme, a Err(ParseError::UrlIsNotHTTPS) will be returned.
  • If a url cannot be parsed into a valid url then a Err(ParseError::Parser(url::ParseError) will be returned.

Creates a new authenticated Firebase instance from the firebaseio url and an auth token.

Examples
let fb = Firebase::authed("https://myfb.firebaseio.com", "deadbeefcafe");
// The url shoud now be: https://myfb.firebaseio.com?auth=deadbeefcafe
Failures
  • If a url is not specified with the HTTPS scheme, a Err(ParseError::UrlIsNotHTTPS) will be returned.
  • If a url cannot be parsed into a valid url then a Err(ParseError::Parser(url::ParseError) will be returned.

Creates a new firebase instance that extends the path of an old firebase instance. Each time a reference is created a clone of the Firebase instance if done, all Firebase instances follow this immutable style.

#Examples

// Points to the root of the db ( / )
let fb = Firebase::new("https://myfb.firebaseio.com").unwrap();
// A new reference to /friends/yasha
let yasha = fb.at("/friends/yasha").unwrap();
// A new reference to /friends/yasha/messages
let messages = yasha.at("messages").unwrap();

Creates a FirebaseParams instance, this instance has query parameters that are associated with it and that are used in every request made. Since query parameters only affect incomming data from Firebase, you can only GET data with a FirebaseParams instance.

This constructor takes in a FbOps struct to define all of its parameters, all undefined parameters can be omitted by extending the new FbOps struct by its default.

Examples
let fb = Firebase::new("https://db.fb.com").unwrap();
let query = fb.ops(&FbOps {
   order_by:       Some("Hello World"),
   limit_to_first: Some(5),
   end_at:         Some(7),
   equal_to:       Some(3),
   shallow:        Some(true),
   format:         Some(true),
   .. FbOps::default()
});

Returns the current URL as a string that will be used to make the REST call when talking to Firebase.

Gets data from Firebase.

Examples
let firebase = Firebase::new("https://shows.firebaseio.com").unwrap();
let episode = firebase.at("/futurama/episodes/140").unwrap();
let info = episode.get();

Sets data to Firebase.

Examples
let firebase = Firebase::new("https://shows.firebaseio.com").unwrap();
let episode = firebase.at("/futurama/episodes/140/description").unwrap();
let info = episode.set("The Last Episode!");

Pushes data to Firebase.

Examples
let firebase = Firebase::new("https://shows.firebaseio.com").unwrap();
let episodes = firebase.at("/futurama/episodes").unwrap();
let info = episodes.push("The Lost Episode");

Updates Firebase data.

Examples
let firebase = Firebase::new("https://shows.firebaseio.com").unwrap();
let desc = firebase.at("/futurama/episodes/140/description").unwrap();
let info = desc.update("The Penultimate Episode!");

Removes Firebase data.

Examples
let firebase = Firebase::new("https://shows.firebaseio.com").unwrap();
let episode = firebase.at("/futurama/episodes/141").unwrap();
episode.remove();

Asynchronous version of the get method, takes a callback and returns a handle to the thread making the request to Firebase.

Examples
let firebase = Firebase::new("https://shows.firebaseio.com").unwrap();
let desc = firebase.at("/futurama/episodes/141/description").unwrap();
let original = "The Lost Episode";
desc.get_async(move |result| {
    if result.unwrap().body != original {
        println!("The description changed!");
    }
});

Asynchronous version of the set method, takes a callback and returns a handle to the thread making the request to Firebase.

Asynchronous version of the push method, takes a callback and returns a handle to the thread making the request to Firebase.

Asynchronous version of the update method, takes a callback and returns a handle to the thread making the request to Firebase.

Asynchronous version of the remove method, takes a callback and returns a handle to the thread making the request to Firebase. Todo remove all the empty hashes

Creates a FirebaseParams instance, a Firebase struct that only knows how to GET data, and sorts this data by the key provided.

Creates a FirebaseParams instance, a Firebase struct that only knows how to GET data, and limits the number of entries returned on each request to the first count. Often used with order_by.

Creates a FirebaseParams instance, a Firebase struct that only knows how to GET data, and limits the number of entries returned on each request to the last count. Often used with order_by.

Creates a FirebaseParams instance, a Firebase struct that only knows how to GET data, and only returns entries starting after the specified index. Often used with order_by.

Creates a FirebaseParams instance, a Firebase struct that only knows how to GET data, and only returns entries appearing before the specified index. Often used with order_by.

Creates a FirebaseParams instance, a Firebase struct that only knows how to GET data, and returns only the entry at the specified index. Often used with order_by.

Creates a FirebaseParams instance, a Firebase struct that only knows how to GET data, and only returns a shallow copy of the db in every request.

Creates a FirebaseParams instance, a Firebase struct that only knows how to GET data, and formats the data to be exported in every request. (e.g. includes a priority field).

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.