# Struct ids::InteractionId

> An interaction: one use of a command, component or modal.

`zaun_community_protocol::ids::InteractionId` · Struct

```rust
pub struct InteractionId(…)
```

An interaction: one use of a command, component or modal.

## Methods

### `from_bytes`

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

Wraps raw bytes.

### `as_bytes`

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

The raw bytes.

### `from_slice`

```rust
pub fn from_slice(bytes: &[u8]) -> Option<Self>
```

Parses a byte slice of exactly `Self::LEN` bytes.

### `from_b64`

```rust
pub fn from_b64(text: &str) -> Result<Self, B64Error>
```

Strict base64url.

# Errors
A non-canonical encoding or a wrong length.

### `to_b64`

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

Base64url without padding.

### `random`

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

A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol).

# Errors
`RngError` when the CSPRNG fails.

## Trait implementations

`Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq`

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