pub struct Fqdn(/* private fields */);Implementations§
Source§impl Fqdn
impl Fqdn
Sourcepub fn new(s: &str) -> Result<Self, String>
pub fn new(s: &str) -> Result<Self, String>
Create a validated FQDN.
Normalizes the value by trimming whitespace, removing a trailing ‘.’, and lowercasing.
§Examples
use firewall_objects::ip::fqdn::Fqdn;
let d = Fqdn::new("WWW.Example.COM.").unwrap();
assert_eq!(d.to_string(), "www.example.com");Invalid inputs fail:
use firewall_objects::ip::fqdn::Fqdn;
assert!(Fqdn::new("").is_err());
assert!(Fqdn::new("bad label!.com").is_err());
assert!(Fqdn::new("-bad.com").is_err());
assert!(Fqdn::new("bad-.com").is_err());Trait Implementations§
Source§impl Ord for Fqdn
impl Ord for Fqdn
Source§impl PartialOrd for Fqdn
impl PartialOrd for Fqdn
impl Eq for Fqdn
impl StructuralPartialEq for Fqdn
Auto Trait Implementations§
impl Freeze for Fqdn
impl RefUnwindSafe for Fqdn
impl Send for Fqdn
impl Sync for Fqdn
impl Unpin for Fqdn
impl UnwindSafe for Fqdn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more