diff options
author | Neal H. Walfield <neal@pep.foundation> | 2023-01-06 11:15:13 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2023-01-06 12:41:41 +0100 |
commit | 81c471292d3b15f48d236f8432aacf2b734f9d1e (patch) | |
tree | 5e71b870181624ac9669c5a227236dd7d52cb46e /buffered-reader/src/dup.rs | |
parent | e83bf2fd83f5345307d2acf97a5000a8392f182b (diff) |
buffered-reader: Set the buffer size using an environment variable
- If the environment variable `SEQUOIA_BUFFERED_READER_BUFFER` is
set, and we are able to parse it as a usize, use it as the default
buffer size.
Diffstat (limited to 'buffered-reader/src/dup.rs')
-rw-r--r-- | buffered-reader/src/dup.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/buffered-reader/src/dup.rs b/buffered-reader/src/dup.rs index c63ab9c8..cc9f4436 100644 --- a/buffered-reader/src/dup.rs +++ b/buffered-reader/src/dup.rs @@ -177,7 +177,7 @@ mod test { fn buffer_test() { // Test vector. A Dup returns all unconsumed // data. So, use a relatively small buffer size. - let size = DEFAULT_BUF_SIZE; + let size = default_buf_size(); let mut input = Vec::with_capacity(size); let mut v = 0u8; for _ in 0..size { @@ -193,7 +193,7 @@ mod test { let mut reader = Dup::new(reader); for i in 0..input.len() { - let data = reader.data(DEFAULT_BUF_SIZE + 1).unwrap().to_vec(); + let data = reader.data(default_buf_size() + 1).unwrap().to_vec(); assert!(!data.is_empty()); assert_eq!(data, reader.buffer()); // And, we may as well check to make sure we read the |