From c96ae8fce4e53ea9fad111ac7f479f2fa33ef859 Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 13 Dec 2021 00:07:21 -0600 Subject: start implementing joining servers --- minecraft-protocol/src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'minecraft-protocol/src/lib.rs') diff --git a/minecraft-protocol/src/lib.rs b/minecraft-protocol/src/lib.rs index 5d6c8330..31b50164 100644 --- a/minecraft-protocol/src/lib.rs +++ b/minecraft-protocol/src/lib.rs @@ -3,7 +3,7 @@ use std::net::IpAddr; use std::str::FromStr; -pub mod connection; +pub mod connect; pub mod mc_buf; pub mod packets; pub mod resolver; @@ -20,9 +20,12 @@ pub struct ServerIpAddress { pub port: u16, } -impl ServerAddress { +// impl try_from for ServerAddress +impl<'a> TryFrom<&'a str> for ServerAddress { + type Error = String; + /// Convert a Minecraft server address (host:port, the port is optional) to a ServerAddress - pub fn parse(string: &str) -> Result { + fn try_from(string: &str) -> Result { if string.is_empty() { return Err("Empty string".to_string()); } -- cgit v1.2.3