make JID struct etc. public

This commit is contained in:
cel 🌸 2023-06-16 14:48:19 +01:00
parent 9cdf4953fe
commit e9c742f4a9
Signed by: cel
GPG Key ID: 48E29AF13B5F1349
1 changed files with 10 additions and 6 deletions

View File

@ -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(),