Add tokio_boring::HandshakeError::as_source_stream
This commit is contained in:
parent
66cabd882c
commit
8fc84f01e0
|
|
@ -277,13 +277,21 @@ impl<S> HandshakeError<S> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Converts error to the source data stream tha was used for the handshake.
|
||||
/// Converts error to the source data stream that was used for the handshake.
|
||||
pub fn into_source_stream(self) -> Option<S> {
|
||||
match self.0 {
|
||||
ssl::HandshakeError::Failure(s) => Some(s.into_source_stream().stream),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a reference to the source data stream.
|
||||
pub fn as_source_stream(&self) -> Option<&S> {
|
||||
match &self.0 {
|
||||
ssl::HandshakeError::Failure(s) => Some(&s.get_ref().stream),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> fmt::Debug for HandshakeError<S>
|
||||
|
|
|
|||
Loading…
Reference in New Issue