mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
Use .advance() intead of .split_to()
This commit is contained in:
parent
1732ae8c79
commit
8c54054844
@ -1,6 +1,6 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## [1.0.xx] - 2019-12-xx
|
## [1.0.1] - 2019-12-xx
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ use std::mem::MaybeUninit;
|
|||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
|
|
||||||
use actix_codec::Decoder;
|
use actix_codec::Decoder;
|
||||||
use bytes::{Bytes, BytesMut};
|
use bytes::{Buf, Bytes, BytesMut};
|
||||||
use http::header::{HeaderName, HeaderValue};
|
use http::header::{HeaderName, HeaderValue};
|
||||||
use http::{header, Method, StatusCode, Uri, Version};
|
use http::{header, Method, StatusCode, Uri, Version};
|
||||||
use httparse;
|
use httparse;
|
||||||
@ -477,7 +477,7 @@ macro_rules! byte (
|
|||||||
($rdr:ident) => ({
|
($rdr:ident) => ({
|
||||||
if $rdr.len() > 0 {
|
if $rdr.len() > 0 {
|
||||||
let b = $rdr[0];
|
let b = $rdr[0];
|
||||||
let _ = $rdr.split_to(1);
|
$rdr.advance(1);
|
||||||
b
|
b
|
||||||
} else {
|
} else {
|
||||||
return Poll::Pending
|
return Poll::Pending
|
||||||
|
@ -8,7 +8,7 @@ use actix_codec::{AsyncRead, AsyncWrite, Decoder, Encoder, Framed, FramedParts};
|
|||||||
use actix_rt::time::{delay_until, Delay, Instant};
|
use actix_rt::time::{delay_until, Delay, Instant};
|
||||||
use actix_service::Service;
|
use actix_service::Service;
|
||||||
use bitflags::bitflags;
|
use bitflags::bitflags;
|
||||||
use bytes::BytesMut;
|
use bytes::{Buf, BytesMut};
|
||||||
use log::{error, trace};
|
use log::{error, trace};
|
||||||
|
|
||||||
use crate::body::{Body, BodySize, MessageBody, ResponseBody};
|
use crate::body::{Body, BodySize, MessageBody, ResponseBody};
|
||||||
@ -312,7 +312,7 @@ where
|
|||||||
}
|
}
|
||||||
Poll::Pending => {
|
Poll::Pending => {
|
||||||
if written > 0 {
|
if written > 0 {
|
||||||
let _ = self.write_buf.split_to(written);
|
self.write_buf.advance(written);
|
||||||
}
|
}
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ where
|
|||||||
if written == self.write_buf.len() {
|
if written == self.write_buf.len() {
|
||||||
unsafe { self.write_buf.set_len(0) }
|
unsafe { self.write_buf.set_len(0) }
|
||||||
} else {
|
} else {
|
||||||
let _ = self.write_buf.split_to(written);
|
self.write_buf.advance(written);
|
||||||
}
|
}
|
||||||
Ok(false)
|
Ok(false)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
use bytes::{BufMut, BytesMut};
|
use bytes::{Buf, BufMut, BytesMut};
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use rand;
|
use rand;
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ impl Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove prefix
|
// remove prefix
|
||||||
let _ = src.split_to(idx);
|
src.advance(idx);
|
||||||
|
|
||||||
// no need for body
|
// no need for body
|
||||||
if length == 0 {
|
if length == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user