pub enum TdsStream {
Plain(TcpStream),
Tls(Box<TlsStream<TdsHandshakeStream>>),
Closed,
}Expand description
A TDS connection, before or after encryption.
An enum rather than a boxed trait object for the same reason the HTTP client uses one: there are exactly two cases, they are known at compile time, and a virtual call per read on a database connection buys nothing.
Variants§
Plain(TcpStream)
Tls(Box<TlsStream<TdsHandshakeStream>>)
Closed
No transport, only ever seen for the instant it takes to swap one kind for another mid-handshake. A real placeholder rather than a dummy socket so that a bug here reports itself instead of hanging on a dead file descriptor.
Implementations§
Source§impl TdsStream
impl TdsStream
pub async fn write_all(&mut self, bytes: &[u8]) -> Result<()>
pub async fn flush(&mut self) -> Result<()>
pub async fn read(&mut self, buffer: &mut [u8]) -> Result<usize>
pub async fn shutdown(&mut self) -> Result<()>
Sourcepub fn take(&mut self) -> TdsStream
pub fn take(&mut self) -> TdsStream
Take the transport, leaving TdsStream::Closed behind.
Sourcepub fn into_plain(self) -> Result<TdsStream>
pub fn into_plain(self) -> Result<TdsStream>
Tear the TLS session down and go back to the bare socket, which is what ENCRYPT_OFF asks for once the login packet has been sent.
Auto Trait Implementations§
impl !Freeze for TdsStream
impl !RefUnwindSafe for TdsStream
impl !UnwindSafe for TdsStream
impl Send for TdsStream
impl Sync for TdsStream
impl Unpin for TdsStream
impl UnsafeUnpin for TdsStream
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