Class SerialStatelessReplayLastSubjectAsync<T>
- Namespace
- ReactiveUI.Extensions.Async.Subjects
- Assembly
- ReactiveUI.Extensions.dll
Represents a serial, stateless asynchronous subject that replays only the last value to new observers and supports asynchronous notification delivery.
public sealed class SerialStatelessReplayLastSubjectAsync<T> : BaseStatelessReplayLastSubjectAsync<T>, ISubjectAsync<T>, IObserverAsync<T>, IAsyncDisposable, IObservableAsync<T>
Type Parameters
TThe type of the elements processed by the subject.
- Inheritance
-
SerialStatelessReplayLastSubjectAsync<T>
- Implements
- Inherited Members
- Extension Methods
Remarks
This subject delivers notifications to observers one at a time in the order they are received. It does not maintain any state beyond the most recent value, and only the last value (if any) is replayed to new subscribers. All observer notifications are dispatched asynchronously and serially, ensuring that each observer receives notifications in the correct order.
Constructors
SerialStatelessReplayLastSubjectAsync(Optional<T>)
Represents a serial, stateless asynchronous subject that replays only the last value to new observers and supports asynchronous notification delivery.
public SerialStatelessReplayLastSubjectAsync(Optional<T> startValue)
Parameters
startValueOptional<T>An optional initial value to be replayed to new observers before any values are published. If not specified, no value is replayed until the first value is received.
Remarks
This subject delivers notifications to observers one at a time in the order they are received. It does not maintain any state beyond the most recent value, and only the last value (if any) is replayed to new subscribers. All observer notifications are dispatched asynchronously and serially, ensuring that each observer receives notifications in the correct order.
Methods
OnCompletedAsyncCore(IReadOnlyList<IObserverAsync<T>>, Result)
Notifies all observers that the asynchronous operation has completed, passing the specified result to each observer.
protected override ValueTask OnCompletedAsyncCore(IReadOnlyList<IObserverAsync<T>> observers, Result result)
Parameters
observersIReadOnlyList<IObserverAsync<T>>A read-only list of observers to be notified of the operation's completion. Cannot be null.
resultResultThe result to provide to each observer upon completion.
Returns
- ValueTask
A task that represents the asynchronous notification operation.
Remarks
Each observer in the list is notified sequentially by invoking its OnCompletedAsync method with the provided result. If any observer's notification fails, the exception will propagate and may prevent subsequent observers from being notified.
OnErrorResumeAsyncCore(IReadOnlyList<IObserverAsync<T>>, Exception, CancellationToken)
Notifies each observer in the collection to resume after an error has occurred, using asynchronous operations.
protected override ValueTask OnErrorResumeAsyncCore(IReadOnlyList<IObserverAsync<T>> observers, Exception error, CancellationToken cancellationToken)
Parameters
observersIReadOnlyList<IObserverAsync<T>>A read-only list of observers to be notified to resume after the error. Cannot be null.
errorExceptionThe exception that caused the error. Cannot be null.
cancellationTokenCancellationTokenA cancellation token that can be used to cancel the asynchronous operation.
Returns
- ValueTask
A task that represents the asynchronous notification operation.
OnNextAsyncCore(IReadOnlyList<IObserverAsync<T>>, T, CancellationToken)
Asynchronously notifies each observer in the specified collection with the provided value.
protected override ValueTask OnNextAsyncCore(IReadOnlyList<IObserverAsync<T>> observers, T value, CancellationToken cancellationToken)
Parameters
observersIReadOnlyList<IObserverAsync<T>>A read-only list of observers to be notified. Cannot be null.
valueTThe value to send to each observer.
cancellationTokenCancellationTokenA cancellation token that can be used to cancel the notification operation.
Returns
- ValueTask
A task that represents the asynchronous notification operation.