mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-04-02 18:15:37 +00:00
implement Titan protocol features
This commit is contained in:
parent
66a0de6a8e
commit
29b835411d
8 changed files with 204 additions and 27 deletions
22
src/client/connection/request/gemini.rs
Normal file
22
src/client/connection/request/gemini.rs
Normal 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())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue