mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 17:15:31 +00:00
implement to_bytes method
This commit is contained in:
parent
f4c9b73925
commit
a9283770db
1 changed files with 9 additions and 1 deletions
|
|
@ -7,7 +7,7 @@ pub use gemini::Gemini;
|
||||||
pub use titan::Titan;
|
pub use titan::Titan;
|
||||||
|
|
||||||
use gio::NetworkAddress;
|
use gio::NetworkAddress;
|
||||||
use glib::Uri;
|
use glib::{Bytes, Uri};
|
||||||
|
|
||||||
/// Single `Request` implementation for different protocols
|
/// Single `Request` implementation for different protocols
|
||||||
pub enum Request {
|
pub enum Request {
|
||||||
|
|
@ -35,6 +35,14 @@ impl Request {
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
||||||
|
/// Get [Bytes](https://docs.gtk.org/glib/struct.Bytes.html) for `Self`
|
||||||
|
pub fn to_bytes(&self) -> Bytes {
|
||||||
|
match self {
|
||||||
|
Self::Gemini(ref request) => request.to_bytes(),
|
||||||
|
Self::Titan(ref request) => request.to_bytes(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Get [NetworkAddress](https://docs.gtk.org/gio/class.NetworkAddress.html) for `Self`
|
/// Get [NetworkAddress](https://docs.gtk.org/gio/class.NetworkAddress.html) for `Self`
|
||||||
pub fn to_network_address(&self, default_port: u16) -> Result<NetworkAddress, Error> {
|
pub fn to_network_address(&self, default_port: u16) -> Result<NetworkAddress, Error> {
|
||||||
match crate::gio::network_address::from_uri(
|
match crate::gio::network_address::from_uri(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue