Table of Contents

Class PipeReaderExtensions

Namespace
IceRpc.Slice
Assembly
IceRpc.Slice.dll

Provides extension methods for PipeReader to decode streamed elements.

public static class PipeReaderExtensions
Inheritance
PipeReaderExtensions
Inherited Members

Methods

ToAsyncEnumerable<T>(PipeReader, SliceEncoding, DecodeFunc<T>, IProxy?, ISliceFeature?)

Creates an async enumerable over a pipe reader to decode variable size streamed elements.

public static IAsyncEnumerable<T> ToAsyncEnumerable<T>(this PipeReader reader, SliceEncoding encoding, DecodeFunc<T> decodeFunc, IProxy? sender = null, ISliceFeature? sliceFeature = null)

Parameters

reader PipeReader

The pipe reader.

encoding SliceEncoding

The Slice encoding version.

decodeFunc DecodeFunc<T>

The function used to decode the streamed member.

sender IProxy

The proxy that sent the request, if applicable.

sliceFeature ISliceFeature

The slice feature to customize the decoding.

Returns

IAsyncEnumerable<T>

The async enumerable to decode and return the streamed members.

Type Parameters

T

The stream element type.

Remarks

The reader ownership is transferred to the returned async enumerable. The caller should no longer use the reader after this call.

ToAsyncEnumerable<T>(PipeReader, SliceEncoding, DecodeFunc<T>, int, ISliceFeature?)

Creates an async enumerable over a pipe reader to decode streamed elements.

public static IAsyncEnumerable<T> ToAsyncEnumerable<T>(this PipeReader reader, SliceEncoding encoding, DecodeFunc<T> decodeFunc, int elementSize, ISliceFeature? sliceFeature = null)

Parameters

reader PipeReader

The pipe reader.

encoding SliceEncoding

The Slice encoding version.

decodeFunc DecodeFunc<T>

The function used to decode the streamed member.

elementSize int

The size in bytes of one element.

sliceFeature ISliceFeature

The Slice feature to customize the decoding.

Returns

IAsyncEnumerable<T>

The async enumerable to decode and return the streamed elements.

Type Parameters

T

The type of the element being decoded.

Remarks

The reader ownership is transferred to the returned async enumerable. The caller should no longer use the reader after this call.

Exceptions

ArgumentException

Thrown if elementSize is equal of inferior to 0.