pub struct App<'a> {
pub name : &'a str,
pub options : Options<'a>,
}
pub struct Options<'a> {
pub application_id: &'a str,
pub api_key: &'a str,
pub database_url: Option<&'a str>,
pub ga_tracking_id: Option<&'a str>,
pub storage_bucket: Option<&'a str>,
pub project_id: Option<&'a str>,
pub gcm_sender_id: Option<&'a str>,
pub auth_domain: Option<&'a str>,
}
impl<'a> App<'a> {
const fn new(name : &'a str,options : Options<'a>) -> Self {
App {
name : name ,
options : options
}
}
}
impl<'a> Options<'a> {
const fn new(application_id : &'a str,api_key : &'a str) -> Self {
Options {
application_id : application_id ,
api_key : api_key,
database_url : None,
ga_tracking_id : None,
storage_bucket : None,
project_id : None,
gcm_sender_id : None,
auth_domain : None,
}
}
const fn with_database_url(mut self,database_url: &'a str) -> Self {
self.database_url = Some(database_url);
self
}
const fn with_ga_tracking_id(mut self,ga_tracking_id: &'a str) -> Self {
self.ga_tracking_id = Some(ga_tracking_id);
self
}
const fn with_storage_bucket(mut self,storage_bucket: &'a str) -> Self {
self.storage_bucket = Some(storage_bucket);
self
}
const fn with_project_id(mut self,project_id: &'a str) -> Self {
self.project_id = Some(project_id);
self
}
const fn with_gcm_sender_id(mut self,gcm_sender_id: &'a str) -> Self {
self.gcm_sender_id = Some(gcm_sender_id);
self
}
const fn with_auth_domain(mut self,auth_domain: &'a str) -> Self {
self.auth_domain = Some(auth_domain);
self
}
}