aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-03-24 14:24:20 +0000
committerFuwn <[email protected]>2024-03-24 14:34:09 +0000
commit3970616451ab4336e37a7ddfdc67f51e01e55926 (patch)
tree6bf9fa01811004ff408ac5da40354bc34ddabc26 /examples
parentfeat(crate): bump version (diff)
downloadgerm-3970616451ab4336e37a7ddfdc67f51e01e55926.tar.xz
germ-3970616451ab4336e37a7ddfdc67f51e01e55926.zip
refactor: module for blocking, default to non-blocking
Diffstat (limited to 'examples')
-rw-r--r--examples/request.rs7
-rw-r--r--examples/request_blocking.rs (renamed from examples/async_request.rs)9
-rw-r--r--examples/request_blocking_to_gemtext_from_ast.rs (renamed from examples/request_to_gemtext_from_ast.rs)4
3 files changed, 11 insertions, 9 deletions
diff --git a/examples/request.rs b/examples/request.rs
index e33710f..33de2da 100644
--- a/examples/request.rs
+++ b/examples/request.rs
@@ -16,8 +16,11 @@
// Copyright (C) 2022-2022 Fuwn <[email protected]>
// SPDX-License-Identifier: GPL-3.0-only
-fn main() {
- match germ::request::request(&url::Url::parse("gemini://fuwn.me").unwrap()) {
+#[tokio::main]
+async fn main() {
+ match germ::request::request(&url::Url::parse("gemini://fuwn.me").unwrap())
+ .await
+ {
Ok(response) => println!("{:?}", response),
Err(_) => {}
}
diff --git a/examples/async_request.rs b/examples/request_blocking.rs
index 604d6d4..fed1c41 100644
--- a/examples/async_request.rs
+++ b/examples/request_blocking.rs
@@ -16,13 +16,10 @@
// Copyright (C) 2022-2022 Fuwn <[email protected]>
// SPDX-License-Identifier: GPL-3.0-only
-#[tokio::main]
-async fn main() {
- match germ::request::sync::request(
+fn main() {
+ match germ::request::blocking::request(
&url::Url::parse("gemini://fuwn.me").unwrap(),
- )
- .await
- {
+ ) {
Ok(response) => println!("{:?}", response),
Err(_) => {}
}
diff --git a/examples/request_to_gemtext_from_ast.rs b/examples/request_blocking_to_gemtext_from_ast.rs
index 2127433..6abfdfb 100644
--- a/examples/request_to_gemtext_from_ast.rs
+++ b/examples/request_blocking_to_gemtext_from_ast.rs
@@ -17,7 +17,9 @@
// SPDX-License-Identifier: GPL-3.0-only
fn main() {
- match germ::request::request(&url::Url::parse("gemini://fuwn.me/").unwrap()) {
+ match germ::request::blocking::request(
+ &url::Url::parse("gemini://fuwn.me/").unwrap(),
+ ) {
Ok(response) => println!(
"{}",
germ::ast::Ast::from_string(