Atmoos.Progress.Reporting 0.1.1

.NET 6.0
dotnet add package Atmoos.Progress.Reporting --version 0.1.1
NuGet\Install-Package Atmoos.Progress.Reporting -Version 0.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Atmoos.Progress.Reporting" Version="0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Atmoos.Progress.Reporting --version 0.1.1
#r "nuget: Atmoos.Progress.Reporting, 0.1.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Atmoos.Progress.Reporting as a Cake Addin
#addin nuget:?package=Atmoos.Progress.Reporting&version=0.1.1

// Install Atmoos.Progress.Reporting as a Cake Tool
#tool nuget:?package=Atmoos.Progress.Reporting&version=0.1.1

Progress Reporting

This library contains generic functionality on the IProgress<T> interface. In particular, filter and mapping functions.

Concept

Similar to Linq, all functionality is exposed via extension methods. This allows for an API that lets you create fluent and easily readable code.

Examples

These examples all assume there is some instance (client) of IProgress<T> to which progress is to be reported. This is the progress root.

Also assume there is some pre-processing of the raw incoming progress reports before they should be reported. A typical scenario would be rate limiting or type conversion.

ToDo: Graphic:

raw IProgress<T'> --> [pre-processing] --> report to root IProgress<T>

Filters

Generic filters on types that implement IComparable<T>:

IProgress<T> progress = /* progress root */;
IProgress<T> bounded = progress.Bounded(lower, upper).Inclusive();
IProgress<T> monotonicDecreasing = bounded.Monotonic().Decreasing();
IProgress<T> monotonicStrictlyIncreasing = bounded.Monotonic().Strictly.Increasing();

Report progressing in increments no smaller than a given value on numeric types:

IProgress<Double> progress = /* progress root */;
IProgress<Double> incremental = progress.Incremental(increment: 0.1);

Mapping

Progress can be mapped from any type to any other type, by just using a simple (lambda) expression. In this example from any type to a string.

IProgress<String> progress = /* consumes progress reports as string */;
IProgress<T> mapsToString = progress.Map((T p) => p.ToString());

Aggregation

Aggregation of progress via Zip is currently the only aggregation available.

IProgress<Double> channelA = /* report to some independent channel */;
IProgress<Double> channelB = /* report to some other independent channel */;
IProgress<T> combined = channelA.Zip(channelB);

Convenience

Convenience components that are largely useful for writing unit tests. Also, for when no progress is needed at all, i.e. Empty progress.

IProgress<T> progress = Empty<T>();

IProgress<T> observable = progress.Observable((T p) => WriteLine($"Current progress: {p}"));

ProgressRecorder<T> recorder = new();
T progressAtPosition = recorder[3];
T lastRecordedValue = recorder[^1];
IEnumerable<T> filteredValues = recorder.Where(p => p is not null);
Product Versions
.NET net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Atmoos.Progress.Reporting:

Package Downloads
Atmoos.Progress.Tree

Library that enables hierarchical progress reporting. Sequential and parallel reporting are supported, both with three reporting models.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.1 248 12/12/2021

First version