diff options
author | cel 🌸 <cel@blos.sm> | 2023-06-16 14:48:19 +0100 |
---|---|---|
committer | cel 🌸 <cel@blos.sm> | 2023-06-16 14:48:19 +0100 |
commit | e9c742f4a9bade2020e34e32f3daf021d6c61448 (patch) | |
tree | efc3bea22ef102979ddf077b584171229034dd82 /src/jid/mod.rs | |
parent | 9cdf4953fe6d09f2ca00113eb2a4df1c73c207e4 (diff) | |
download | luz-e9c742f4a9bade2020e34e32f3daf021d6c61448.tar.gz luz-e9c742f4a9bade2020e34e32f3daf021d6c61448.tar.bz2 luz-e9c742f4a9bade2020e34e32f3daf021d6c61448.zip |
make JID struct etc. public
Diffstat (limited to 'src/jid/mod.rs')
-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(), |