mirror of
https://github.com/netbirdio/IronRDP.git
synced 2026-05-22 18:43:12 -07:00
feat: add new_from_leftover on Framed
This commit is contained in:
committed by
Benoît Cortier
parent
f834305563
commit
40740169e0
@@ -66,9 +66,13 @@ where
|
||||
S: StreamWrapper,
|
||||
{
|
||||
pub fn new(stream: S::InnerStream) -> Self {
|
||||
Self::new_with_leftover(stream, BytesMut::new())
|
||||
}
|
||||
|
||||
pub fn new_with_leftover(stream: S::InnerStream, leftover: BytesMut) -> Self {
|
||||
Self {
|
||||
stream: S::from_inner(stream),
|
||||
buf: BytesMut::new(),
|
||||
buf: leftover,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,11 @@ pub struct Framed<S> {
|
||||
|
||||
impl<S> Framed<S> {
|
||||
pub fn new(stream: S) -> Self {
|
||||
Self {
|
||||
stream,
|
||||
buf: BytesMut::new(),
|
||||
}
|
||||
Self::new_with_leftover(stream, BytesMut::new())
|
||||
}
|
||||
|
||||
pub fn new_with_leftover(stream: S, leftover: BytesMut) -> Self {
|
||||
Self { stream, buf: leftover }
|
||||
}
|
||||
|
||||
pub fn into_inner(self) -> (S, BytesMut) {
|
||||
|
||||
Reference in New Issue
Block a user