mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 17:15:31 +00:00
update example
This commit is contained in:
parent
dc2300b1c0
commit
517153656b
1 changed files with 10 additions and 15 deletions
25
README.md
25
README.md
|
|
@ -42,12 +42,10 @@ cargo add ggemini
|
||||||
use gio::*;
|
use gio::*;
|
||||||
use glib::*;
|
use glib::*;
|
||||||
|
|
||||||
|
|
||||||
use ggemini::client::{
|
use ggemini::client::{
|
||||||
connection::{
|
connection::{response::Success, Request, Response},
|
||||||
Request, Response,
|
Client,
|
||||||
response::meta::{Mime, Status}
|
|
||||||
},
|
|
||||||
Client, Error,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() -> ExitCode {
|
fn main() -> ExitCode {
|
||||||
|
|
@ -58,20 +56,17 @@ fn main() -> ExitCode {
|
||||||
Priority::DEFAULT,
|
Priority::DEFAULT,
|
||||||
Cancellable::new(),
|
Cancellable::new(),
|
||||||
None, // optional `GTlsCertificate`
|
None, // optional `GTlsCertificate`
|
||||||
|result: Result<Response, Error>| match result {
|
|result| match result {
|
||||||
Ok(response) => {
|
Ok((response, _connection)) => match response {
|
||||||
// route by status code
|
Response::Success(success) => match success {
|
||||||
match response.meta.status {
|
Success::Default { mime } => match mime.as_str() {
|
||||||
// code 20, handle `GIOStream` by content type
|
|
||||||
Status::Success => match response.meta.mime.unwrap().as_str() {
|
|
||||||
// gemtext, see ggemtext crate to parse
|
|
||||||
"text/gemini" => todo!(),
|
"text/gemini" => todo!(),
|
||||||
// other content types
|
|
||||||
_ => todo!(),
|
_ => todo!(),
|
||||||
},
|
},
|
||||||
_ => todo!(),
|
_ => todo!(),
|
||||||
}
|
},
|
||||||
}
|
_ => todo!(),
|
||||||
|
},
|
||||||
Err(_) => todo!(),
|
Err(_) => todo!(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue