Decode the protobuf wire format in Gleam!
3

Configure Feed

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

Decode failure on bad fixed instead of panic

Gavin Morrow (Sep 22, 2025, 8:57 PM EDT) 191e768f 853fa452

+4 -2
+4 -2
src/decoders.gleam
··· 100 100 101 101 pub fn fixed(size: Int) -> Decoder(Int) { 102 102 use bits <- decode.then(single_or_raw(decode.bit_array)) 103 - let assert <<num:unsigned-little-size(size)>> = bits 104 - num |> decode.success 103 + case bits { 104 + <<num:unsigned-little-size(size)>> -> decode.success(num) 105 + _ -> decode.failure(0, "Fixed(" <> int.to_string(size) <> ")") 106 + } 105 107 } 106 108 107 109 pub fn string() -> Decoder(String) {