use std::{
ffi::{CString, IntoStringError},
io,
net::{SocketAddr, ToSocketAddrs},
ops::Deref,
result::Result,
string::FromUtf8Error,
vec::IntoIter,
};
use crate::JustString;
impl ToSocketAddrs for JustString<'_> {
type Iter = IntoIter<SocketAddr>;
fn to_socket_addrs(&self) -> io::Result<Self::Iter> {
self.deref().to_socket_addrs()
}
}
impl TryFrom<CString> for JustString<'_> {
type Error = IntoStringError;
fn try_from(value: CString) -> Result<Self, Self::Error> {
String::try_from(value).map(JustString::String)
}
}
impl TryFrom<Vec<u8>> for JustString<'_> {
type Error = FromUtf8Error;
fn try_from(value: Vec<u8>) -> Result<Self, Self::Error> {
String::try_from(value).map(JustString::String)
}
}