MCPcopy Create free account
hub / github.com/consensus-shipyard/ipc / parse_array

Function parse_array

fendermint/actors/blobs/shared/src/bytes.rs:74–82  ·  view source on GitHub ↗

Parse from a base32 string into a byte array

(input: &str)

Source from the content-addressed store, hash-verified

72
73/// Parse from a base32 string into a byte array
74fn parse_array<const N: usize>(input: &str) -> Result<[u8; N], DecodeError> {
75 data_encoding::BASE32_NOPAD
76 .decode(input.to_ascii_uppercase().as_bytes())?
77 .try_into()
78 .map_err(|_| DecodeError {
79 position: N,
80 kind: DecodeKind::Length,
81 })
82}
83
84impl std::fmt::Display for B256 {
85 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {

Callers

nothing calls this directly

Calls 2

try_intoMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected