Rename MaybeIncompleteDataError
...to BufferOverflowError
This commit is contained in:
parent
ba54f4cf57
commit
b073670732
10
src/lib.rs
10
src/lib.rs
@ -53,11 +53,11 @@ fn gen_session_id() -> u32 {
|
|||||||
/// The response may be incomplete, if the buffer has been filled up,
|
/// The response may be incomplete, if the buffer has been filled up,
|
||||||
/// because excess bytes that don't fit into it are discarded.
|
/// because excess bytes that don't fit into it are discarded.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
pub struct MaybeIncompleteDataError(usize);
|
pub struct BufferOverflowError(usize);
|
||||||
|
|
||||||
impl Error for MaybeIncompleteDataError {}
|
impl Error for BufferOverflowError {}
|
||||||
|
|
||||||
impl Display for MaybeIncompleteDataError {
|
impl Display for BufferOverflowError {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "Buffer filled up")
|
write!(f, "Buffer filled up")
|
||||||
}
|
}
|
||||||
@ -175,7 +175,7 @@ impl BasicQueryRequest {
|
|||||||
// Receiving
|
// Receiving
|
||||||
let bytes_read = tokioTimeout(timeout, socket.recv(buffer)).await??;
|
let bytes_read = tokioTimeout(timeout, socket.recv(buffer)).await??;
|
||||||
if bytes_read == buffer.len() {
|
if bytes_read == buffer.len() {
|
||||||
return Err(io::Error::new(ErrorKind::Other, MaybeIncompleteDataError(bytes_read)));
|
return Err(io::Error::new(ErrorKind::Other, BufferOverflowError(bytes_read)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parsing
|
// Parsing
|
||||||
@ -302,7 +302,7 @@ impl FullQueryRequest {
|
|||||||
// Receiving
|
// Receiving
|
||||||
let bytes_read = tokioTimeout(timeout, socket.recv(buffer)).await??;
|
let bytes_read = tokioTimeout(timeout, socket.recv(buffer)).await??;
|
||||||
if bytes_read == buffer.len() {
|
if bytes_read == buffer.len() {
|
||||||
return Err(io::Error::new(ErrorKind::Other, MaybeIncompleteDataError(bytes_read)));
|
return Err(io::Error::new(ErrorKind::Other, BufferOverflowError(bytes_read)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parsing
|
// Parsing
|
||||||
|
Loading…
Reference in New Issue
Block a user