add 'get_ref()' and 'get_mut()' to 'Accept' (#104)
* add 'get_ref()' and 'get_mut()' to 'Accept' * add 'get_ref()' and 'get_mut()' to 'Connect'
This commit is contained in:
parent
bcf4f8e3f9
commit
f1c7d22ad3
@ -308,6 +308,22 @@ impl<IO> Connect<IO> {
|
||||
pub fn into_fallible(self) -> FallibleConnect<IO> {
|
||||
FallibleConnect(self.0)
|
||||
}
|
||||
|
||||
pub fn get_ref(&self) -> Option<&IO> {
|
||||
match &self.0 {
|
||||
MidHandshake::Handshaking(sess) => Some(sess.get_ref().0),
|
||||
MidHandshake::Error { io, .. } => Some(io),
|
||||
MidHandshake::End => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_mut(&mut self) -> Option<&mut IO> {
|
||||
match &mut self.0 {
|
||||
MidHandshake::Handshaking(sess) => Some(sess.get_mut().0),
|
||||
MidHandshake::Error { io, .. } => Some(io),
|
||||
MidHandshake::End => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<IO> Accept<IO> {
|
||||
@ -315,6 +331,22 @@ impl<IO> Accept<IO> {
|
||||
pub fn into_fallible(self) -> FallibleAccept<IO> {
|
||||
FallibleAccept(self.0)
|
||||
}
|
||||
|
||||
pub fn get_ref(&self) -> Option<&IO> {
|
||||
match &self.0 {
|
||||
MidHandshake::Handshaking(sess) => Some(sess.get_ref().0),
|
||||
MidHandshake::Error { io, .. } => Some(io),
|
||||
MidHandshake::End => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_mut(&mut self) -> Option<&mut IO> {
|
||||
match &mut self.0 {
|
||||
MidHandshake::Handshaking(sess) => Some(sess.get_mut().0),
|
||||
MidHandshake::Error { io, .. } => Some(io),
|
||||
MidHandshake::End => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<IO: AsyncRead + AsyncWrite + Unpin> Future for Connect<IO> {
|
||||
|
Loading…
Reference in New Issue
Block a user