Support for S3 bucket prefixes
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user