Support for S3 bucket prefixes

This commit is contained in:
mdecimus
2024-03-02 09:33:36 +01:00
parent 0bd4f8148e
commit 417bc38288
2 changed files with 27 additions and 9 deletions

View File

@@ -57,8 +57,12 @@ impl Base32Writer {
}
pub fn with_capacity(capacity: usize) -> Self {
Self::with_raw_capacity((capacity + 3) / 4 * 5)
}
pub fn with_raw_capacity(capacity: usize) -> Self {
Base32Writer {
result: String::with_capacity((capacity + 3) / 4 * 5),
result: String::with_capacity(capacity),
last_byte: 0,
pos: 0,
}
@@ -68,6 +72,10 @@ impl Base32Writer {
self.result.push(ch);
}
pub fn push_string(&mut self, string: &str) {
self.result.push_str(string);
}
fn push_byte(&mut self, byte: u8, is_remainder: bool) {
let (ch1, ch2) = match self.pos % 5 {
0 => ((byte & 0xF8) >> 3, u8::MAX),