Crates.io | hkulibrary |
lib.rs | hkulibrary |
version | 0.2.0 |
source | src |
created_at | 2023-06-29 13:31:32.81478 |
updated_at | 2023-07-18 11:13:20.582985 |
description | a user-friendly client for HKU library |
homepage | https://github.com/adlsdztony/hkulibrary |
repository | https://github.com/adlsdztony/hkulibrary |
max_upload_size | |
id | 903291 |
size | 14,897 |
a user-friendly client for HKU Library
use hkulibrary::{LibClient,Task};
#[tokio::main]
async fn main() {
let client = LibClient::new();
let task = Task::new("2023-06-29","08300930","129");
client.login("username", "password")
.await.unwrap()
.book(&task)
.await.unwrap();
}
Task has a From
implementation for (&str, &str, &str)
, so you can also do
use hkulibrary::LibClient;
#[tokio::main]
async fn main() {
let client = LibClient::new();
client.login("username", "password")
.await.unwrap()
.book(&("2023-06-29","08300930","129").into())
.await.unwrap();
}
or
use hkulibrary::LibClient;
async fn book() -> Result<(), Box<dyn std::error::Error>> {
let client = LibClient::new();
client.login("username", "password")
.await?
.book(&("2023-06-29","08300930","129").into())
.await?;
Ok(())
}