From 51ea2896cdcdf7b6027f96421a0ce2b454486e03 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 4 Aug 2021 18:09:12 +0200 Subject: docs: init adds --- src/browser/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/browser/mod.rs') 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>> { if let Some(driver) = &WEB_BROWSER { if let Some(faculties) = driver.faculties().await? { -- cgit v1.2.3-18-g5258