Glib/Gio-oriented network API for Gemini protocol
Important
Project in development!
GGemini (or G-Gemini) library written as the client extension for Yoda, it also could be useful for other GTK-based applications with glib and gio (2.66+
) dependency.
cargo add ggemini
use gtk::gio::*;
use gtk::glib::*;
use ggemini::client::{
connection::{
response::meta::{Mime, Status},
Response,
},
Client, Error,
};
fn main() -> ExitCode {
Client::new().request_async(
Uri::parse("gemini://geminiprotocol.net/", UriFlags::NONE).unwrap(),
Priority::DEFAULT,
Cancellable::new(),
None, // optional `GTlsCertificate`
|result: Result<Response, Error>| match result {
Ok(response) => {
match response.meta.status {
// route by status code
Status::Success => match response.meta.mime {
// handle `GIOStream` by content type
Some(Mime::TextGemini) => todo!(),
_ => todo!(),
},
_ => todo!(),
}
}
Err(e) => todo!("{e}"),
},
);
ExitCode::SUCCESS
}
- ggemtext - Glib-oriented Gemtext API