implement Titan protocol features

This commit is contained in:
yggverse 2025-01-13 21:22:03 +02:00
parent 66a0de6a8e
commit 29b835411d
8 changed files with 204 additions and 27 deletions

View file

@ -0,0 +1,22 @@
use glib::{Bytes, Uri};
/// [Gemini](https://geminiprotocol.net/docs/protocol-specification.gmi) protocol enum object for `Request`
pub struct Gemini {
pub uri: Uri,
}
impl Gemini {
// Constructors
/// Build valid new `Self`
pub fn build(uri: Uri) -> Self {
Self { uri } // @TODO validate
}
// Getters
/// Copy `Self` to [Bytes](https://docs.gtk.org/glib/struct.Bytes.html)
pub fn to_bytes(&self) -> Bytes {
Bytes::from(format!("{}\r\n", self.uri).as_bytes())
}
}