From e9c742f4a9bade2020e34e32f3daf021d6c61448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cel=20=F0=9F=8C=B8?= Date: Fri, 16 Jun 2023 14:48:19 +0100 Subject: [PATCH] make JID struct etc. public --- src/jid/mod.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/jid/mod.rs b/src/jid/mod.rs index f39a1c3..4baa857 100644 --- a/src/jid/mod.rs +++ b/src/jid/mod.rs @@ -1,21 +1,25 @@ use std::str::FromStr; #[derive(PartialEq, Debug)] -struct JID { +pub struct JID { // TODO: validate localpart (length, char] - localpart: Option, - domainpart: String, - resourcepart: Option, + pub localpart: Option, + pub domainpart: String, + pub resourcepart: Option, } #[derive(Debug)] -enum JIDParseError { +pub enum JIDParseError { Empty, Malformed, } impl JID { - fn new(localpart: Option, domainpart: String, resourcepart: Option) -> Self { + pub fn new( + localpart: Option, + domainpart: String, + resourcepart: Option, + ) -> Self { Self { localpart, domainpart: domainpart.parse().unwrap(),