Skip to content

Commit d730b57

Browse files
author
Oren (electricessence)
committed
Improvements.
1 parent bc97216 commit d730b57

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

Extensions.Pipe.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,28 @@ namespace Open.Threading.Dataflow
99
{
1010
public static partial class DataFlowExtensions
1111
{
12+
/// <summary>
13+
/// Pipes the source data to the target.
14+
/// </summary>
15+
/// <typeparam name="T">The input type.</typeparam>
16+
/// <param name="source">The source block to receive from.</param>
17+
/// <param name="transform">The target block to post to.</param>
18+
/// <returns>The target block.</returns>
19+
public static TBlock Pipe<T, TBlock>(this ISourceBlock<T> source,
20+
TBlock target)
21+
where TBlock : ITargetBlock<T>
22+
{
23+
if (source == null)
24+
throw new NullReferenceException();
25+
if (target == null)
26+
throw new ArgumentNullException(nameof(target));
27+
Contract.EndContractBlock();
28+
29+
source.LinkToWithCompletion(target);
30+
return target;
31+
}
32+
33+
1234
/// <summary>
1335
/// Produces a source block that contains transformed results.
1436
/// </summary>

Filters/AcceptOrPass.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static partial class DataFlowExtensions
5252
/// <param name="source">The source block to receive from.</param>
5353
/// <param name="acceptor">The function to process the item and decide if accepted.</param>
5454
/// <returns>The original source block to allow for more acceptors or filters to be applied.</returns>
55-
public static ISourceBlock<T> AcceptOrPass<T>(this ISourceBlock<T> source,
55+
public static ISourceBlock<T> TakeOrContinue<T>(this ISourceBlock<T> source,
5656
Func<T, bool> acceptor)
5757
{
5858
var receiver = new AcceptOrPassBlock<T>(acceptor);

Open.Threading.Dataflow.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ Part of the "Open" set of libraries.</Description>
1515
<RepositoryUrl>https://github.com/electricessence/Open.Threading.Dataflow/</RepositoryUrl>
1616
<RepositoryType>git</RepositoryType>
1717
<PackageTags>dotnet, dotnet-core, dotnetcore, cs, dataflow, tpl, extensions</PackageTags>
18-
<Version>2.1.2</Version>
18+
<Version>2.2.0</Version>
1919
<PackageReleaseNotes></PackageReleaseNotes>
20-
<AssemblyVersion>2.1.2.0</AssemblyVersion>
21-
<FileVersion>2.1.2.0</FileVersion>
20+
<AssemblyVersion>2.2.0.0</AssemblyVersion>
21+
<FileVersion>2.2.0.0</FileVersion>
2222
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2323
</PropertyGroup>
2424

0 commit comments

Comments
 (0)