Atmoos.Progress.Reporting 0.1.3

dotnet add package Atmoos.Progress.Reporting --version 0.1.3                
NuGet\Install-Package Atmoos.Progress.Reporting -Version 0.1.3                
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.3" />                
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.3                
#r "nuget: Atmoos.Progress.Reporting, 0.1.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. 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.3

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

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 Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.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.3 120 5/20/2024
0.1.2 173 10/8/2023
0.1.1 458 12/12/2021

First version