---
title: "Channel"
description: "This page lists the Rust SDK names for Channels."
canonical_url: "https://docs.superdurable.io/reference/rust/channel/"
source: "docs/reference/rust/channel.mdx"
locale: "en"
---

# Channel

This page lists the Rust SDK names for [Channels](https://docs.superdurable.io/concepts/primitives/channel.md).
The doc comment of each API gives its parameters, defaults, and errors. Read
them in the [Rust SDK API reference](https://docs.superdurable.io/reference/rust.md#api-reference).

<a id="api-names"></a>

## API names

| Task                                           | Rust API                                                                                                   | Dex behavior                                                                                                               |
| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| Define a Channel                               | **Channel**                                                                                                | [Channels](https://docs.superdurable.io/reference/server/runtime-data.md#channels)                                         |
| Define a ChannelMap                            | **ChannelMap**                                                                                             | [ChannelMap](https://docs.superdurable.io/reference/server/runtime-data.md#channelmap)                                     |
| Declare it in the Flow                         | **PersistenceSchema::channel** and **PersistenceSchema::channel_map**, returned from **Flow::persistence** | [Flow definition](https://docs.superdurable.io/reference/rust/flow.md#flow-definition)                                     |
| Publish a message from a Step or RPC           | **publish**                                                                                                | [Commits](https://docs.superdurable.io/reference/rust/step.md#commit-boundary)                                             |
| Wait for messages                              | **for_one**, **for_n**, **at_least**, **at_most**, and **range**                                           | [Wait conditions](https://docs.superdurable.io/reference/server/runtime-data.md#channel-conditions)                        |
| Read the messages a wait consumed              | **condition_results**                                                                                      | [Channel results](https://docs.superdurable.io/reference/rust/waits.md#channel-results)                                    |
| Load pending messages for a method             | **ChannelMap::load_messages**, with the load methods of **StepOptions** or **Rpc**                         | [Selective state loading](https://docs.superdurable.io/reference/rust/step-options.md#selective-state-loading)             |
| Read loaded pending messages                   | **pending_messages** and **find_pending_message**                                                          | [Pending messages](https://docs.superdurable.io/reference/server/runtime-data.md#manage-pending-messages)                  |
| Delete a pending message                       | **delete**                                                                                                 | [Pending messages](https://docs.superdurable.io/reference/server/runtime-data.md#manage-pending-messages)                  |
| Read the number of pending messages            | **size**                                                                                                   | [Selective state loading](https://docs.superdurable.io/reference/rust/step-options.md#selective-state-loading)             |
| Count ChannelMap instances and list their keys | **ChannelMap::map_size** and **ChannelMap::all_instance_keys**                                             | [ChannelMap](https://docs.superdurable.io/reference/server/runtime-data.md#channelmap)                                     |
| Complete the Flow only when Channels are empty | **StepDecision::force_complete_if_channels_empty**, with **when_empty**                                    | [ForceCompleteIfChannelsEmpty](https://docs.superdurable.io/reference/rust/step-decisions.md#forcecompleteifchannelsempty) |

<a id="example"></a>

## Example

Example: [examples/rust/src/primitives/channel/flow.rs](https://github.com/superdurable/dex/tree/main/examples/rust/src/primitives/channel/flow.rs)
