summaryrefslogtreecommitdiff
path: root/src/cargo_toml.rs
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-06-01 15:01:18 +0200
committermo8it <mo8it@proton.me>2024-06-01 15:01:18 +0200
commit84a818dbda156aeccf97d8dc0a33daeef084013a (patch)
treee7bde6ed3dedde5adc713a4246bc04fccecf6adb /src/cargo_toml.rs
parentbeb7b24e8e9fe05cbcfaaf4676d52f63351fad16 (diff)
Update the bins buffer capacity
Diffstat (limited to 'src/cargo_toml.rs')
-rw-r--r--src/cargo_toml.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cargo_toml.rs b/src/cargo_toml.rs
index cf17acd..c4d6700 100644
--- a/src/cargo_toml.rs
+++ b/src/cargo_toml.rs
@@ -3,6 +3,9 @@ use std::path::Path;
use crate::info_file::ExerciseInfo;
+/// Initial capacity of the bins buffer.
+pub const BINS_BUFFER_CAPACITY: usize = 1 << 14;
+
/// Return the start and end index of the content of the list `bin = […]`.
/// bin = [xxxxxxxxxxxxxxxxx]
/// |start_ind |
@@ -70,7 +73,7 @@ pub fn updated_cargo_toml(
) -> Result<Vec<u8>> {
let (bins_start_ind, bins_end_ind) = bins_start_end_ind(current_cargo_toml)?;
- let mut updated_cargo_toml = Vec::with_capacity(1 << 13);
+ let mut updated_cargo_toml = Vec::with_capacity(BINS_BUFFER_CAPACITY);
updated_cargo_toml.extend_from_slice(current_cargo_toml[..bins_start_ind].as_bytes());
append_bins(
&mut updated_cargo_toml,