[−][src]Struct address::domain::Domain
Represents a domain name.
Methods
impl Domain
[src]
pub fn get_localhost() -> Self
[src]
Gets the localhost domain.
use address::domain::Domain; assert_eq!(Domain::get_localhost().to_string(), "localhost");
impl Domain
[src]
pub const MAX_LABEL_LENGTH: usize
[src]
The maximum length of a domain label.
pub const MAX_DOMAIN_LENGTH: usize
[src]
The maximum length of a domain name.
pub fn is_valid_label(label: &[u8]) -> bool
[src]
Checks if the domain label is valid. This function is case insensitive.
use address::domain::Domain; assert!(!Domain::is_valid_label("".as_bytes())); assert!(Domain::is_valid_label("a".as_bytes())); assert!(Domain::is_valid_label("A".as_bytes())); assert!(Domain::is_valid_label("0".as_bytes())); assert!(!Domain::is_valid_label("a-".as_bytes())); assert!(!Domain::is_valid_label("-a".as_bytes())); assert!(Domain::is_valid_label("a-b".as_bytes()));
pub fn is_valid_domain(name: &[u8]) -> bool
[src]
Checks if the domain name is valid. This function is case-insensitive.
use address::domain::Domain; assert!(!Domain::is_valid_domain("".as_bytes())); assert!(Domain::is_valid_domain("a".as_bytes())); assert!(!Domain::is_valid_domain("a.".as_bytes())); assert!(!Domain::is_valid_domain(".a".as_bytes())); assert!(Domain::is_valid_domain("a.b".as_bytes()));
impl Domain
[src]
Trait Implementations
impl Clone for Domain
[src]
impl Eq for Domain
[src]
impl Ord for Domain
[src]
fn cmp(&self, other: &Domain) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Domain> for Domain
[src]
impl PartialOrd<Domain> for Domain
[src]
fn partial_cmp(&self, other: &Domain) -> Option<Ordering>
[src]
fn lt(&self, other: &Domain) -> bool
[src]
fn le(&self, other: &Domain) -> bool
[src]
fn gt(&self, other: &Domain) -> bool
[src]
fn ge(&self, other: &Domain) -> bool
[src]
impl Display for Domain
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
use address::domain::Domain; use std::convert::TryFrom; assert_eq!(Domain::try_from("a").ok().unwrap().to_string(), "a");
impl Debug for Domain
[src]
impl<'_> TryFrom<&'_ [u8]> for Domain
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(value: &[u8]) -> Result<Self, Self::Error>
[src]
use address::domain::Domain; use std::convert::TryFrom; let e: Result<Domain, &'static str> = Err("Invalid Domain"); assert_eq!(Domain::try_from(""), e); assert_eq!(Domain::try_from("a").ok().unwrap().to_string(), "a"); assert_eq!(Domain::try_from("a."), e); assert_eq!(Domain::try_from(".a"), e); assert_eq!(Domain::try_from("a.b").ok().unwrap().to_string(), "a.b");
impl<'_> TryFrom<&'_ str> for Domain
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(value: &str) -> Result<Self, Self::Error>
[src]
impl Hash for Domain
[src]
Auto Trait Implementations
impl Send for Domain
impl Sync for Domain
impl Unpin for Domain
impl UnwindSafe for Domain
impl RefUnwindSafe for Domain
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,