Atmoos.Progress.Reporting
0.1.2
See the version list below for details.
dotnet add package Atmoos.Progress.Reporting --version 0.1.2
NuGet\Install-Package Atmoos.Progress.Reporting -Version 0.1.2
<PackageReference Include="Atmoos.Progress.Reporting" Version="0.1.2" />
paket add Atmoos.Progress.Reporting --version 0.1.2
#r "nuget: Atmoos.Progress.Reporting, 0.1.2"
// Install Atmoos.Progress.Reporting as a Cake Addin #addin nuget:?package=Atmoos.Progress.Reporting&version=0.1.2 // Install Atmoos.Progress.Reporting as a Cake Tool #tool nuget:?package=Atmoos.Progress.Reporting&version=0.1.2
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 Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net7.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.
First version