fix: fetch artist albums continuation

This commit is contained in:
ThetaDev 2024-10-22 23:56:59 +02:00
parent be18d89ea6
commit b589061a40
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6
17 changed files with 50309 additions and 38906 deletions

View file

@ -1,7 +1,7 @@
/// [`ProtoBuilder`] is used to construct protobuf messages using a builder pattern
#[derive(Debug, Default)]
pub struct ProtoBuilder {
pub bytes: Vec<u8>,
bytes: Vec<u8>,
}
impl ProtoBuilder {
@ -39,6 +39,11 @@ impl ProtoBuilder {
self._varint(val);
}
/// Returns `true` if the builder contains no data
pub fn is_empty(&self) -> bool {
self.bytes.is_empty()
}
/// Write a varint field
pub fn varint(&mut self, field: u32, val: u64) {
self._field(field, 0);
@ -52,6 +57,13 @@ impl ProtoBuilder {
self.bytes.extend_from_slice(string.as_bytes());
}
/// Write a bytes field
pub fn bytes(&mut self, field: u32, bytes: &[u8]) {
self._field(field, 2);
self._varint(bytes.len() as u64);
self.bytes.extend_from_slice(bytes);
}
/// Write an embedded message
///
/// Requires passing another [`ProtoBuilder`] with the embedded message.