diff options
Diffstat (limited to 'src/jid')
-rw-r--r-- | src/jid/mod.rs | 16 |
1 files 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<String>, - domainpart: String, - resourcepart: Option<String>, + pub localpart: Option<String>, + pub domainpart: String, + pub resourcepart: Option<String>, } #[derive(Debug)] -enum JIDParseError { +pub enum JIDParseError { Empty, Malformed, } impl JID { - fn new(localpart: Option<String>, domainpart: String, resourcepart: Option<String>) -> Self { + pub fn new( + localpart: Option<String>, + domainpart: String, + resourcepart: Option<String>, + ) -> Self { Self { localpart, domainpart: domainpart.parse().unwrap(), |