set DEFAULT_PORT cost as global

This commit is contained in:
yggverse 2024-11-27 18:21:16 +02:00
parent ffda3d27e3
commit b9be89ca0f
3 changed files with 8 additions and 3 deletions

View file

@ -17,7 +17,6 @@ use gio::{
};
use glib::{Bytes, Priority, Uri};
pub const DEFAULT_PORT: u16 = 1965;
pub const DEFAULT_TIMEOUT: u32 = 10;
pub struct Client {
@ -51,7 +50,7 @@ impl Client {
certificate: Option<TlsCertificate>,
callback: impl Fn(Result<Response, Error>) + 'static,
) {
match crate::gio::network_address::from_uri(&uri, DEFAULT_PORT) {
match crate::gio::network_address::from_uri(&uri, crate::DEFAULT_PORT) {
Ok(network_address) => {
self.socket.connect_async(
&network_address.clone(),

View file

@ -1,7 +1,7 @@
pub mod error;
pub use error::Error;
use crate::client::DEFAULT_PORT;
use crate::DEFAULT_PORT;
use gio::NetworkAddress;
use glib::{GString, Uri, UriFlags, UriHideFlags};

View file

@ -1,4 +1,10 @@
pub mod client;
pub mod gio;
// Main API
pub use client::Client;
// Global defaults
pub const DEFAULT_PORT: u16 = 1965;