From 517153656b50509c5afda6440b6d611771d672b9 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 3 Feb 2025 02:09:41 +0200 Subject: [PATCH] update example --- README.md | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 23ee9de..57c3f75 100644 --- a/README.md +++ b/README.md @@ -42,12 +42,10 @@ cargo add ggemini use gio::*; use glib::*; + use ggemini::client::{ - connection::{ - Request, Response, - response::meta::{Mime, Status} - }, - Client, Error, + connection::{response::Success, Request, Response}, + Client, }; fn main() -> ExitCode { @@ -58,20 +56,17 @@ fn main() -> ExitCode { Priority::DEFAULT, Cancellable::new(), None, // optional `GTlsCertificate` - |result: Result| match result { - Ok(response) => { - // route by status code - match response.meta.status { - // code 20, handle `GIOStream` by content type - Status::Success => match response.meta.mime.unwrap().as_str() { - // gemtext, see ggemtext crate to parse + |result| match result { + Ok((response, _connection)) => match response { + Response::Success(success) => match success { + Success::Default { mime } => match mime.as_str() { "text/gemini" => todo!(), - // other content types _ => todo!(), }, _ => todo!(), - } - } + }, + _ => todo!(), + }, Err(_) => todo!(), }, );