mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 17:15:31 +00:00
Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11d17e004e | ||
|
|
bba51e38e8 | ||
|
|
0f6eaa563c | ||
|
|
7e9ecf64b3 |
4 changed files with 25 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "ggemini"
|
||||
version = "0.19.0"
|
||||
version = "0.20.1"
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
readme = "README.md"
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ pub fn from_stream_async(
|
|||
size.total += bytes.len();
|
||||
on_chunk(bytes.clone(), size.total);
|
||||
|
||||
if let Some(limit) = size.limit {
|
||||
if size.total > limit {
|
||||
return on_complete(Err(Error::BytesTotal(size.total, limit)));
|
||||
}
|
||||
if let Some(limit) = size.limit
|
||||
&& size.total > limit
|
||||
{
|
||||
return on_complete(Err(Error::BytesTotal(size.total, limit)));
|
||||
}
|
||||
|
||||
if bytes.is_empty() {
|
||||
|
|
|
|||
|
|
@ -5,3 +5,13 @@ pub struct Size {
|
|||
pub limit: Option<usize>,
|
||||
pub total: usize,
|
||||
}
|
||||
|
||||
impl Default for Size {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
chunk: 0x10000, // 64KB
|
||||
limit: None,
|
||||
total: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,3 +4,13 @@ pub struct Size {
|
|||
pub limit: usize,
|
||||
pub total: usize,
|
||||
}
|
||||
|
||||
impl Default for Size {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
chunk: 0x10000, // 64KB
|
||||
limit: 0xfffff, // 1 MB
|
||||
total: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue