# TestSequencer

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui-testing/struct-testsequencer/

**struct** · [`ferroui-reactiveui-testing`](/docs/0.5.0/api/ferroui-reactiveui-testing/) · v0.5.0

```rust
struct TestSequencer
```

Two participants of a test that wait for each other phase by phase: each calls
`advance_phase_async` at the end of its part of a phase, and the
phase completes when both have (`TestSequencer`, a `Barrier` of two participants).

Deviation (DEVIATIONS.md, ReactiveUI): the observables are single-threaded, so the two
participants are two tasks of the current thread instead of two threads: the task of the first
participant to arrive ends when the second one arrives, and the task of the second one has
ended when `advance_phase_async` returns. A task is the
`Shared` of a `Result<(), ObservableError>` (`flatten()` is a future of it); its
continuations run when it ends, so upstream's `Task.Yield()` after the barrier has no
counterpart.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Testing/test_sequencer.rs#L21)

## Members

- [`new`](#function-new)
- [`completed_phases`](#function-completed_phases)
- [`current_phase`](#function-current_phase)
- [`advance_phase_async`](#function-advance_phase_async)
- [`advance_phase_async_with`](#function-advance_phase_async_with)

<a id="function-new"></a>

### new

```rust
fn new() -> Self
```

A sequencer before its first phase.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Testing/test_sequencer.rs#L40)

<a id="function-completed_phases"></a>

### completed_phases

```rust
fn completed_phases(self: &Self) -> i64
```

The number of phases both participants completed (`CompletedPhases`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Testing/test_sequencer.rs#L45)

<a id="function-current_phase"></a>

### current_phase

```rust
fn current_phase(self: &Self) -> i64
```

The phase the participants are in, set when the first of them arrives (`CurrentPhase`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Testing/test_sequencer.rs#L50)

<a id="function-advance_phase_async"></a>

### advance_phase_async

```rust
fn advance_phase_async(self: &Self) -> Shared<Result<(), ObservableError>>
```

Ends the part of the current phase of the calling participant; the task ends when the other
participant has ended its part too (`AdvancePhaseAsync()`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Testing/test_sequencer.rs#L56)

<a id="function-advance_phase_async_with"></a>

### advance_phase_async_with

```rust
fn advance_phase_async_with(self: &Self, comment: &str) -> Shared<Result<(), ObservableError>>
```

`advance_phase_async`, with a comment that names the phase for
the reader of the test (`AdvancePhaseAsync(string)`).
## Panics
When the sequencer is disposed, where upstream's barrier throws `ObjectDisposedException`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Testing/test_sequencer.rs#L65)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `Default`
- `Debug`
- [`IDisposable`](/docs/0.5.0/api/ferroui-base/reactive/use-idisposable/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
