ruststream 0.7.5

Async messaging framework for Rust: broker-agnostic traits, router, codecs, and a conformance harness for broker authors.
Documentation
---
sidebar_position: 10
title: with_options
description: "with_options checks the per-message settings the latest recorded publish carried, the value a builder step set."
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# with_options

[`with_options`](api:ruststream::testing::PublishedAssertions::with_options) checks the per-message settings the latest recorded publish carried, the value a builder step set.

Per-message settings are the broker's [`Publisher::Options`](api:ruststream::Publisher); the memory broker's publisher has none, so the example wraps it with a priority, as a networked broker ships one.
The harness records the settings with every publish the runtime makes (a reply, a slot publish, a retry copy), on the broker it went to.
Both records read them: a slot record, [`out::<M>()`](../records/out.md), and a destination record, `published::<T>(name)`.
A message the test publishes itself carries no recorded settings.
The assertion names the broker's own type and panics when the latest publish carried no settings, carried another type, or carried a different value.
It also panics when it cannot tell which settings the latest publish carried: another publish to the destination had the same payload, and either their order is unknown or the harness never saw that publish.
[`assert_options_default`](./assert-options-default.md) checks that no step set any.

## Example

<Tabs groupId="api">
<TabItem value="macros" label="Macros">

```rust reference="examples/testing_published_options.rs#with-options"
```

</TabItem>
<TabItem value="manual" label="Manual">

```rust reference="examples/manual/testing_published_options.rs#with-options"
```

</TabItem>
</Tabs>