ggemini/README.md
2024-10-25 19:30:19 +03:00

2.2 KiB

ggemini

Glib-oriented client for Gemini protocol

Important

Project in development!

Install

cargo add ggemini

Usage

client

client::single_socket_request_async

High-level API to make async socket request and auto-close connection on complete.

Return Response on success or Error enum on failure.

use glib::{Uri, UriFlags};

// Parse URL string to valid Glib URI object
match Uri::parse("gemini://geminiprotocol.net/", UriFlags::NONE) {
    // Begin async request
    Ok(uri) => ggemini::client::single_socket_request_async(uri, |result| match result {
        // Process response
        Ok(response) => {
            // Expect success status
            assert!(match response.header().status() {
                Some(ggemini::client::response::header::Status::Success) => true,
                _ => false,
            })
        }
        Err(_) => assert!(false),
    }),
    Err(_) => assert!(false),
}

Pay attention:

  • Response Buffer limited to default capacity (0x400) and max_size (0xfffff). If you want to change these values, use low-level API to setup connection manually.
  • If you want to use Cancelable or async Priority values, take a look at connection methods.

client::Error

client::response

client::response::Response

client::response::header

client::response::header::meta

client::response::header::mime

client::response::header::status

client::response::header::language

client::response::header::charset

client::response::body

client::socket

client::socket::connection

client::socket::connection::input

client::socket::connection::input::buffer

client::socket::connection::input::buffer::Buffer

client::socket::connection::output

Integrations

  • Yoda - Browser for Gemini Protocol

See also