Glib-oriented client for Gemini protocol https://crates.io/crates/ggemini
Find a file
2025-03-25 03:21:59 +02:00
.github add funding info 2025-02-15 21:11:41 +02:00
src reduce local var names len 2025-03-25 03:21:59 +02:00
.gitignore init crate 2024-10-18 21:34:49 +03:00
Cargo.toml begin header holder implementation with lazy parser by getters, add request::Mode, add common header_bytes helper 2025-03-24 06:50:08 +02:00
LICENSE Initial commit 2024-10-18 21:24:15 +03:00
README.md rename mode const 2025-03-24 19:57:54 +02:00

ggemini

Build Documentation crates.io

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 dependent of glib / gio (2.66+) backend.

Requirements

Debian
sudo apt install libglib2.0-dev
Fedora
sudo dnf install glib2-devel

Install

cargo add ggemini

Usage

Example

use gio::*;
use glib::*;

use ggemini::client::{
    connection::{request::{Mode, Request}, Response},
    Client,
};

fn main() -> ExitCode {
    Client::new().request_async(
        Request::Gemini { // or `Request::Titan`
            uri: Uri::parse("gemini://geminiprotocol.net/", UriFlags::NONE).unwrap(),
            mode: Mode::HeaderOnly // handle content separately (based on MIME)
        },
        Priority::DEFAULT,
        Cancellable::new(),
        None, // optional `GTlsCertificate`
        |result| match result {
            Ok((response, _connection)) => match response {
                Response::Success(success) => match success {
                    Success::Default(default) => match default.header.mime().unwrap().as_str() {
                        "text/gemini" => todo!(),
                        _ => todo!(),
                    }
                },
                _ => todo!(),
            },
            Err(_) => todo!(),
        },
    );
    ExitCode::SUCCESS
}

Other crates