From 1c661e35956a6555a85fb59f3c8611e8c6765555 Mon Sep 17 00:00:00 2001 From: Mikko Rantanen Date: Sat, 30 May 2020 11:32:22 +0300 Subject: [PATCH] Add `as_str` to `DNSName` --- src/name.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/name.rs b/src/name.rs index 24cb69f0..23edee87 100644 --- a/src/name.rs +++ b/src/name.rs @@ -42,6 +42,9 @@ pub struct DNSName(String); impl DNSName { /// Returns a `DNSNameRef` that refers to this `DNSName`. pub fn as_ref(&self) -> DNSNameRef { DNSNameRef(self.0.as_bytes()) } + + /// Returns this `DNSName` as `&str` + pub fn as_str(&self) -> &str { self.0.as_ref() } } #[cfg(feature = "std")]