diff options
author | Santo Cariotti <santo@dcariotti.me> | 2021-08-04 18:09:12 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2021-08-04 18:09:12 +0200 |
commit | 51ea2896cdcdf7b6027f96421a0ce2b454486e03 (patch) | |
tree | 22eaae83fd2655cad9bc477bc59ce3fb92539788 /src/browser/mod.rs | |
parent | 7c445e6458b6b209ce59ed89dbb73daa96e2199f (diff) |
docs: init adds
Diffstat (limited to 'src/browser/mod.rs')
-rw-r--r-- | src/browser/mod.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/browser/mod.rs b/src/browser/mod.rs index d5ec337..7205f27 100644 --- a/src/browser/mod.rs +++ b/src/browser/mod.rs @@ -6,12 +6,16 @@ use thirtyfour::prelude::WebDriverResult; mod web_browser; +/// Create a new instance of `Browser` and associate it with the static variable `WEB_BROWSER`. +/// This is an unsecure type of usage, so the block is inside the `unsafe` block pub async fn init(driver_url: &String) { unsafe { WEB_BROWSER = Some(Browser::new(driver_url).await); } } +/// Login using the credentials from the `Config`. 'Cause its kind of nature +/// this is an `unsafe` block, so the function is defined like that pub async unsafe fn login(credentials: &Config) -> WebDriverResult<()> { if let Some(driver) = &WEB_BROWSER { driver._login(credentials).await?; @@ -20,6 +24,7 @@ pub async unsafe fn login(credentials: &Config) -> WebDriverResult<()> { Ok(()) } +/// Get the faculties available for booking a room pub async unsafe fn get_faculties() -> WebDriverResult<Option<HashMap<String, String>>> { if let Some(driver) = &WEB_BROWSER { if let Some(faculties) = driver.faculties().await? { |