Struct mhost::app::resolver::NameBuilder
source · pub struct NameBuilder { /* private fields */ }
Expand description
NameBuilder offers a safe way to transform a string into a Name
.
NameBuilder
takes the search domain into account by checking ndots
to qualify a name as FQDN or not.
Implementations§
source§impl NameBuilder
impl NameBuilder
pub fn new(config: NameBuilderOpts) -> NameBuilder
sourcepub fn from_str(&self, name: &str) -> Result<Name>
pub fn from_str(&self, name: &str) -> Result<Name>
Creates a Name
from a &str.
In case the given name has less or equal lables (dots) as configures by NameBuilderConfig::ndots
the search
domain NameBuilderConfig::search_domain
is added to resulting Name
.
Example:
let config = NameBuilderOpts::new(1, "example.com").unwrap();
let builder = NameBuilder::new(config);
let name = builder.from_str("www").unwrap();
assert_eq!(name, Name::from_ascii("www.example.com.").unwrap())
Auto Trait Implementations§
impl RefUnwindSafe for NameBuilder
impl Send for NameBuilder
impl Sync for NameBuilder
impl Unpin for NameBuilder
impl UnwindSafe for NameBuilder
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