make JID struct etc. public
This commit is contained in:
parent
9cdf4953fe
commit
e9c742f4a9
|
@ -1,21 +1,25 @@
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
struct JID {
|
pub struct JID {
|
||||||
// TODO: validate localpart (length, char]
|
// TODO: validate localpart (length, char]
|
||||||
localpart: Option<String>,
|
pub localpart: Option<String>,
|
||||||
domainpart: String,
|
pub domainpart: String,
|
||||||
resourcepart: Option<String>,
|
pub resourcepart: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum JIDParseError {
|
pub enum JIDParseError {
|
||||||
Empty,
|
Empty,
|
||||||
Malformed,
|
Malformed,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl JID {
|
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 {
|
Self {
|
||||||
localpart,
|
localpart,
|
||||||
domainpart: domainpart.parse().unwrap(),
|
domainpart: domainpart.parse().unwrap(),
|
||||||
|
|
Loading…
Reference in New Issue