> Aztec.nr API reference, v6.0.0 (mainnet and testnet). Index: https://docs.aztec.network/aztec-nr-api/mainnet/llms.txt

# Struct CompressedString

Module: `compressed_string`

```rust
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

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

```rust
pub fn from_string(input_string: str<M>) -> Self
```

```rust
pub fn to_bytes(self) -> [u8; M]
```

## Trait implementations

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

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

```rust
pub fn stream_deserialize<let K: u32>(reader: &mut Reader<K>) -> Self
```

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

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

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

```rust
pub fn pack(self) -> [Field; N * 1]
```

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

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

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

```rust
pub fn stream_serialize<let K: u32>(self, writer: &mut Writer<K>)
```
