# Struct framing::FragId

> A fragment id: 8 random bytes, unique per sender per connection among open reassemblies.

`zaun_community_protocol::framing::FragId` · Struct

```rust
pub struct FragId(…)
```

A fragment id: 8 random bytes, unique per sender per connection among open reassemblies.

## Methods

### `from_bytes`

```rust
pub const fn from_bytes(bytes: [u8; 8]) -> Self
```

Wraps raw bytes (deterministic encoding, tests).

### `random`

```rust
pub fn random() -> Result<Self, RngError>
```

A fresh id from the OS CSPRNG.

# Errors
`RngError` when the CSPRNG fails.

### `as_bytes`

```rust
pub const fn as_bytes(&self) -> &[u8; 8]
```

The raw bytes.

### `from_b64`

```rust
pub fn from_b64(text: &str) -> Option<Self>
```

Strict base64url of exactly `FRAG_ID_CHARS` characters.

### `to_b64`

```rust
pub fn to_b64(&self) -> String
```

Base64url without padding (11 characters).

## Trait implementations

`Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq`

[Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/struct.FragId.html)
