use crate::misc::Lease;
pub trait StreamWithTls {
type TlsServerEndPoint: Lease<[u8]>;
fn tls_server_end_point(&self) -> crate::Result<Option<Self::TlsServerEndPoint>>;
}
impl StreamWithTls for () {
type TlsServerEndPoint = [u8; 0];
#[inline]
fn tls_server_end_point(&self) -> crate::Result<Option<Self::TlsServerEndPoint>> {
Ok(None)
}
}
impl<T> StreamWithTls for &T
where
T: StreamWithTls,
{
type TlsServerEndPoint = T::TlsServerEndPoint;
#[inline]
fn tls_server_end_point(&self) -> crate::Result<Option<Self::TlsServerEndPoint>> {
(*self).tls_server_end_point()
}
}