aztec-nr - compressed_string

Struct CompressedString

pub struct CompressedString<let N: u32, let M: u32>
{ /* private fields */ }

Convenience struct for capturing a string of type str<M>, and converting it into other basic Noir types. Notably: converts to [Field; N] or [u8; M]. This particular conversion process tightly-packs the M bytes of the input str into 31-byte chunks, with each chunk being put into a field. Each field can store 31 characters, so N should be M/31 rounded up. Can be used for longer strings that don't fit into a single field.

Implementations

impl<let M: u32, let N: u32> CompressedString<N, M>

pub fn from_string(input_string: str<M>) -> Self pub fn to_bytes(self) -> [u8; M]

Trait implementations

impl<let M: u32, let N: u32> Deserialize for CompressedString<N, M>

pub fn deserialize(serialized: [Field; N * 1]) -> Self

impl<let M: u32, let N: u32> Eq for CompressedString<N, M>

pub fn eq(_self: Self, _other: Self) -> bool

impl<let M: u32, let N: u32> Packable for CompressedString<N, M>

pub fn pack(self) -> [Field; N * 1] pub fn unpack(packed: [Field; N * 1]) -> Self

impl<let M: u32, let N: u32> Serialize for CompressedString<N, M>

pub fn serialize(self) -> [Field; N * 1]