summaryrefslogtreecommitdiff
path: root/src/browser/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/browser/mod.rs')
-rw-r--r--src/browser/mod.rs5
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? {