Table of Contents

Class SpanYielding

Namespace
Garyon.Objects
Assembly
Garyon.dll

Provides helper methods for yielding values from a factory into a Span<T>.

public static class SpanYielding
Inheritance
SpanYielding
Inherited Members

Methods

FillRest<T>(ref SpanYielder<T>)

Fills the rest of the Span<T> from the given instance of SpanYielder<T> using the underlying factory method.

public static ref SpanYielder<T> FillRest<T>(this ref SpanYielder<T> yielder)

Parameters

yielder SpanYielder<T>

The SpanYielder<T> that yields values into the Span<T> using its current factory method.

Returns

SpanYielder<T>

A reference to the provided SpanYielder<T>.

Type Parameters

T

The type of the yielded values.

FillRest<T>(ref SpanYielder<T>, Func<T>)

Fills the rest of the Span<T> from the given instance of SpanYielder<T> using a provided factory method.

public static ref SpanYielder<T> FillRest<T>(this ref SpanYielder<T> yielder, Func<T> factory)

Parameters

yielder SpanYielder<T>

The SpanYielder<T> that yields values into the Span<T> using the provided factory method.

factory Func<T>

The factory method to use for yielding the remaining values.

Returns

SpanYielder<T>

A reference to the provided SpanYielder<T>.

Type Parameters

T

The type of the yielded values.

For<T>(Span<T>, Func<T>)

Creates a new SpanYielder<T> from the affected Span<T> and the factory method.

public static SpanYielder<T> For<T>(Span<T> span, Func<T> factory)

Parameters

span Span<T>

The Span<T> that the yielded values will be inserted into.

factory Func<T>

The factory that will be used to yield values.

Returns

SpanYielder<T>

The new SpanYielder<T> instance with the provided underlying factory method.

Type Parameters

T

The type of the yielded values.

Remarks

Factory is mutable, and the underlying factory method may be changed from another external source.

For<T>(Span<T>, Func<T>, int)

Creates a new SpanYielder<T> from the affected Span<T> and the factory method with a speicifed starting index in the span.

public static SpanYielder<T> For<T>(Span<T> span, Func<T> factory, int startingSpanIndex)

Parameters

span Span<T>

The Span<T> that the yielded values will be inserted into.

factory Func<T>

The factory that will be used to yield values.

startingSpanIndex int

The first index in the span that the values will be yielded on.

Returns

SpanYielder<T>

The new SpanYielder<T> instance with the provided underlying factory method.

Type Parameters

T

The type of the yielded values.

Remarks

Factory is mutable, and the underlying factory method may be changed from another external source.

YieldOntoSpan<T>(Span<T>, int, Func<T>)

Yields a number of values into an existing instance of Span<T>.

public static SpanYielder<T> YieldOntoSpan<T>(Span<T> span, int count, Func<T> factory)

Parameters

span Span<T>

The Span<T> instance to yield the values into.

count int

The number of values to yield.

factory Func<T>

The factory method whose values will be yielded.

Returns

SpanYielder<T>

A constructed SpanYielder<T> instance for yielding further into the specified Span<T> with the given factory method.

Type Parameters

T

The type of the yielded values.

YieldOntoSpan<T>(Span<T>, int, Func<T>, int)

Yields a number of values into an existing instance of Span<T>.

public static SpanYielder<T> YieldOntoSpan<T>(Span<T> span, int count, Func<T> factory, int startingIndex)

Parameters

span Span<T>

The Span<T> instance to yield the values into.

count int

The number of values to yield.

factory Func<T>

The factory method whose values will be yielded.

startingIndex int

The first index in the span that the values will be yielded on.

Returns

SpanYielder<T>

A constructed SpanYielder<T> instance for yielding further into the specified Span<T> with the given factory method.

Type Parameters

T

The type of the yielded values.

Yield<T>(ref SpanYielder<T>, int)

public static ref SpanYielder<T> Yield<T>(this ref SpanYielder<T> yielder, int count)

Parameters

yielder SpanYielder<T>
count int

Returns

SpanYielder<T>

Type Parameters

T

Yield<T>(ref SpanYielder<T>, int, Func<T>)

public static ref SpanYielder<T> Yield<T>(this ref SpanYielder<T> yielder, int count, Func<T> factory)

Parameters

yielder SpanYielder<T>
count int
factory Func<T>

Returns

SpanYielder<T>

Type Parameters

T