pub struct TcpIoWrapper {
pub local_port: u16,
buffer: Vec<u8>,
pos: usize,
retry_write: bool,
}Fields§
§local_port: u16§buffer: Vec<u8>§pos: usizebuffer の読み出し済み位置。
【2026-08-05】以前は読むたびに buffer.drain(0..len) していた。
TLS はレコードヘッダ 5 バイトのように小さく読むので、
そのたびに残り全体を前へ詰め直すことになり O(n²) だった。
一斉計測で受信ループの内訳を割ったところ、
受信待ち=40968/16661
受信sleep=8102/5191 recv呼出=233/6684sleep でも recv でもない残り 32633 tick がここだった。 位置を持てば詰め直しが要らない。
retry_write: boolImplementations§
Source§impl TcpIoWrapper
impl TcpIoWrapper
Trait Implementations§
Source§impl ErrorType for TcpIoWrapper
impl ErrorType for TcpIoWrapper
Source§impl Read for TcpIoWrapper
impl Read for TcpIoWrapper
Source§impl Write for TcpIoWrapper
impl Write for TcpIoWrapper
Source§fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Write a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<(), Self::Error>
fn flush(&mut self) -> Result<(), Self::Error>
Flush this output stream, blocking until all intermediately buffered contents reach their destination.
Auto Trait Implementations§
impl Freeze for TcpIoWrapper
impl RefUnwindSafe for TcpIoWrapper
impl Send for TcpIoWrapper
impl Sync for TcpIoWrapper
impl Unpin for TcpIoWrapper
impl UnsafeUnpin for TcpIoWrapper
impl UnwindSafe for TcpIoWrapper
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