如何丢弃缓冲区内容(如果有)?

如果缓冲区不为空,我想清除缓冲区的内容。 我尝试以下代码:

while self.buf_stream.as_mut().unwrap().read(&mut buff).unwrap() != 0 {}

But read() seems to block if the is nothing in the buffer. How can I detect if there is something in the buffer and discard it if any?

PS:我需要保留缓冲区以便进一步阅读。所以我无法摧毁它。