NavigationResult<TContent> record

Namespace Runic.Navigation in Runic.Navigation 0.23.0

public abstract record NavigationResult<TContent> : IEquatable<NavigationResult<TContent>> where TContent : class

Inherits or implements IEquatable.

The outcome of a navigation request. Navigation outcomes are returned, never thrown.

Type parameters

TContent

The region's content type.

Remarks

This set is closed: it gains cases only in a major release, so an exhaustive switch over the nested records is supported.

Properties

IsCommitted

public bool IsCommitted { get; }

Gets whether the transition committed, so that code after the request may continue.

Outcome

public NavigationOutcome Outcome { get; }

Gets a summary of this result that a Runic View can receive.

Methods

ThrowIfFailed

public NavigationResult<TContent> ThrowIfFailed()

Rethrows the error of a Failed outcome, or the Committed.ArrivalError of a committed one whose arrival hook failed, with its original stack trace, and returns every other outcome unchanged.

Returns

This outcome.

Remarks

A rejected or superseded transition is an expected outcome and does not throw. Combine it with NavigationResult.IsCommitted to handle a request in one line: if (!(await region.PushAsync(target)).ThrowIfFailed().IsCommitted) return;