Decode the protobuf wire format in Gleam! protobin.hexdocs.pm/
gleam protobuf
3

Configure Feed

Select the types of activity you want to include in your feed.

Add string decoder

Gavin Morrow (Sep 19, 2025, 8:34 PM EDT) ead9163b edb38c65

+10
+10
src/protobuf_decode_gleam.gleam
··· 140 140 num |> decode.success 141 141 } 142 142 143 + pub fn decode_string() -> Decoder(String) { 144 + use bits <- decode.then(decode.bit_array) 145 + 146 + let str = bit_array.to_string(bits) 147 + case str { 148 + Ok(str) -> decode.success(str) 149 + Error(_) -> decode.failure("", "String") 150 + } 151 + } 152 + 143 153 fn bit_array_to_uint(bits: BitArray) -> Int { 144 154 let size = bit_array.bit_size(bits) 145 155 // Interpert the entire bit array as an unsigned int