Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Channel Extensions #22

Merged
merged 6 commits into from
Sep 8, 2023
Merged

Channel Extensions #22

merged 6 commits into from
Sep 8, 2023

Conversation

DJGosnell
Copy link
Member

@DJGosnell DJGosnell commented Sep 8, 2023

Modifications

  • Added the following extensions for common scenarios of Channel usage.
  • Added NexusPipeReader.IsComplete property.
  • Fixed issue with AdvanceTo not advancing the examined position.

Usage Exmaple

public static async ValueTask WriteAndComplete<T>(
    this INexusDuplexChannel<T> channel,
    IEnumerable<T> enumerableData,
    int chunkSize = 10,
    CancellationToken cancellationToken = default)

public static async ValueTask WriteAndComplete<T>(
    this INexusChannelWriter<T> writer,
    IEnumerable<T> enumerableData,
    int chunkSize = 10,
    CancellationToken cancellationToken = default)

public static async ValueTask<List<T>> ReadUntilComplete<T>(
    this INexusDuplexChannel<T> channel,
    int estimatedSize = 0,
    CancellationToken cancellationToken = default)

public static async ValueTask<List<T>> ReadUntilComplete<T>(
    this INexusChannelReader<T> reader,
    int estimatedSize = 0,
    CancellationToken cancellationToken = default)

@DJGosnell DJGosnell merged commit 3ae2ac9 into master Sep 8, 2023
@DJGosnell DJGosnell deleted the channel-extensions branch September 17, 2023 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant