Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
public AutoInlineArrayAttribute(int length, Type? elementType = null)
{
if (length <= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
public AutoInlineArrayAttribute(int length, Type? elementType = null)
{
if (length <= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace MyCode;

/// <summary>
/// Represents an inline array InlineArray with 42 elements of type <see cref="global::MyCode.Element"/>.
/// Represents an inline array <see cref="InlineArray"/> with 42 elements.
/// Provides basic equality comparison and hashing. Access elements using the indexer (e.g., myArray[0]).
/// </summary>
[InlineArray(42)]
Expand All @@ -23,28 +23,28 @@ partial struct InlineArray
public int Length => 42;

/// <summary>
/// Returns a <see cref="Span{T}"/> that represents the elements of this inline array.
/// Returns a <see cref="Span{global::MyCode.Element}"/> that represents the elements of this inline array.
/// </summary>
/// <returns>
/// A <see cref="Span{T}"/> of length <c>42</c> that provides mutable access to the elements of the inline array.
/// A <see cref="Span{global::MyCode.Element}"/> of length <c>42</c> that provides mutable access to the elements of the inline array.
/// </returns>
public Span<global::MyCode.Element> AsSpan()
=> MemoryMarshal.CreateSpan(ref Unsafe.As<InlineArray, global::MyCode.Element>(ref this), 42);

/// <summary>
/// Returns a <see cref="ReadOnlySpan{T}"/> that represents the elements of this inline array.
/// Returns a <see cref="ReadOnlySpan{global::MyCode.Element}"/> that represents the elements of this inline array.
/// </summary>
/// <returns>
/// A <see cref="ReadOnlySpan{T}"/> of length <c>42</c> that provides read-only access to the elements of the inline array.
/// A <see cref="ReadOnlySpan{global::MyCode.Element}"/> of length <c>42</c> that provides read-only access to the elements of the inline array.
/// </returns>
public ReadOnlySpan<global::MyCode.Element> AsReadOnlySpan()
=> MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<InlineArray, global::MyCode.Element>(ref this), 42);

/// <summary>
/// Returns an <see cref="IEnumerable{T}"/> that enumerates the elements of this inline array.
/// Returns an <see cref="IEnumerable{global::MyCode.Element}"/> that enumerates the elements of this inline array.
/// </summary>
/// <returns>
/// An <see cref="IEnumerable{T}"/> that iterates over the elements of the inline array in order.
/// An <see cref="IEnumerable{global::MyCode.Element}"/> that iterates over the elements of the inline array in order.
/// </returns>
public IEnumerable<global::MyCode.Element> AsEnumerable()
{
Expand Down Expand Up @@ -107,7 +107,7 @@ public static InlineArray Create(ReadOnlySpan<global::MyCode.Element> source)
=> !(left == right);

/// <summary>
/// Implicitly converts an array of <see cref="global::MyCode.Element"/> to a <see cref="InlineArray"/>.
/// Implicitly converts an array to a <see cref="InlineArray"/>.
/// Copies up to <c>42</c> elements from the source array; extra elements are ignored, and missing elements are default-initialized.
/// </summary>
/// <param name="source">
Expand All @@ -120,7 +120,7 @@ public static implicit operator InlineArray(global::MyCode.Element[] source)
=> source is null ? new() : Create(source);

/// <summary>
/// Implicitly converts a <see cref="ReadOnlySpan{T}"/> of <see cref="global::MyCode.Element"/> to a <see cref="InlineArray"/>.
/// Implicitly converts a <see cref="ReadOnlySpan{global::MyCode.Element}"/> to a <see cref="InlineArray"/>.
/// Copies up to <c>42</c> elements from the source span; extra elements are ignored, and missing elements are default-initialized.
/// </summary>
/// <param name="source">
Expand All @@ -133,7 +133,7 @@ public static implicit operator InlineArray(ReadOnlySpan<global::MyCode.Element>
=> Create(source);

/// <summary>
/// Implicitly converts a <see cref="Span{T}"/> of <see cref="global::MyCode.Element"/> to a <see cref="InlineArray"/>.
/// Implicitly converts a <see cref="Span{global::MyCode.Element}"/> to a <see cref="InlineArray"/>.
/// Copies up to <c>42</c> elements from the source span; extra elements are ignored, and missing elements are default-initialized.
/// </summary>
/// <param name="source">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
public AutoInlineArrayAttribute(int length, Type? elementType = null)
{
if (length <= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
public AutoInlineArrayAttribute(int length, Type? elementType = null)
{
if (length <= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
public AutoInlineArrayAttribute(int length, Type? elementType = null)
{
if (length <= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
public AutoInlineArrayAttribute(int length, Type? elementType = null)
{
if (length <= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
public AutoInlineArrayAttribute(int length, Type? elementType = null)
{
if (length <= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace MyCode;

/// <summary>
/// Represents an inline array ByteInlineArray with 42 elements of type <see cref="byte"/>.
/// Represents an inline array <see cref="ByteInlineArray"/> with 42 elements.
/// Provides basic equality comparison and hashing. Access elements using the indexer (e.g., myArray[0]).
/// </summary>
[InlineArray(42)]
Expand All @@ -25,28 +25,28 @@ partial record struct ByteInlineArray
public int Length => 42;

/// <summary>
/// Returns a <see cref="Span{T}"/> that represents the elements of this inline array.
/// Returns a <see cref="Span{byte}"/> that represents the elements of this inline array.
/// </summary>
/// <returns>
/// A <see cref="Span{T}"/> of length <c>42</c> that provides mutable access to the elements of the inline array.
/// A <see cref="Span{byte}"/> of length <c>42</c> that provides mutable access to the elements of the inline array.
/// </returns>
public Span<byte> AsSpan()
=> MemoryMarshal.CreateSpan(ref Unsafe.As<ByteInlineArray, byte>(ref this), 42);

/// <summary>
/// Returns a <see cref="ReadOnlySpan{T}"/> that represents the elements of this inline array.
/// Returns a <see cref="ReadOnlySpan{byte}"/> that represents the elements of this inline array.
/// </summary>
/// <returns>
/// A <see cref="ReadOnlySpan{T}"/> of length <c>42</c> that provides read-only access to the elements of the inline array.
/// A <see cref="ReadOnlySpan{byte}"/> of length <c>42</c> that provides read-only access to the elements of the inline array.
/// </returns>
public ReadOnlySpan<byte> AsReadOnlySpan()
=> MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<ByteInlineArray, byte>(ref this), 42);

/// <summary>
/// Returns an <see cref="IEnumerable{T}"/> that enumerates the elements of this inline array.
/// Returns an <see cref="IEnumerable{byte}"/> that enumerates the elements of this inline array.
/// </summary>
/// <returns>
/// An <see cref="IEnumerable{T}"/> that iterates over the elements of the inline array in order.
/// An <see cref="IEnumerable{byte}"/> that iterates over the elements of the inline array in order.
/// </returns>
public IEnumerable<byte> AsEnumerable()
{
Expand Down Expand Up @@ -109,7 +109,7 @@ public static ByteInlineArray Create(ReadOnlySpan<byte> source)
=> !(left == right);

/// <summary>
/// Implicitly converts an array of <see cref="byte"/> to a <see cref="ByteInlineArray"/>.
/// Implicitly converts an array to a <see cref="ByteInlineArray"/>.
/// Copies up to <c>42</c> elements from the source array; extra elements are ignored, and missing elements are default-initialized.
/// </summary>
/// <param name="source">
Expand All @@ -122,7 +122,7 @@ public static implicit operator ByteInlineArray(byte[] source)
=> source is null ? new() : Create(source);

/// <summary>
/// Implicitly converts a <see cref="ReadOnlySpan{T}"/> of <see cref="byte"/> to a <see cref="ByteInlineArray"/>.
/// Implicitly converts a <see cref="ReadOnlySpan{byte}"/> to a <see cref="ByteInlineArray"/>.
/// Copies up to <c>42</c> elements from the source span; extra elements are ignored, and missing elements are default-initialized.
/// </summary>
/// <param name="source">
Expand All @@ -135,7 +135,7 @@ public static implicit operator ByteInlineArray(ReadOnlySpan<byte> source)
=> Create(source);

/// <summary>
/// Implicitly converts a <see cref="Span{T}"/> of <see cref="byte"/> to a <see cref="ByteInlineArray"/>.
/// Implicitly converts a <see cref="Span{byte}"/> to a <see cref="ByteInlineArray"/>.
/// Copies up to <c>42</c> elements from the source span; extra elements are ignored, and missing elements are default-initialized.
/// </summary>
/// <param name="source">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
public AutoInlineArrayAttribute(int length, Type? elementType = null)
{
if (length <= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
public AutoInlineArrayAttribute(int length, Type? elementType = null)
{
if (length <= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace MyCode;

/// <summary>
/// Represents an inline array MyInlineArray<T, T2> with 69 elements of type <see cref="T2"/>.
/// Represents an inline array <see cref="MyInlineArray{T, T2}"/> with 69 elements.
/// Provides basic equality comparison and hashing. Access elements using the indexer (e.g., myArray[0]).
/// </summary>
[InlineArray(69)]
Expand All @@ -23,28 +23,28 @@ partial record struct MyInlineArray<T, T2>
public int Length => 69;

/// <summary>
/// Returns a <see cref="Span{T}"/> that represents the elements of this inline array.
/// Returns a <see cref="Span{T2}"/> that represents the elements of this inline array.
/// </summary>
/// <returns>
/// A <see cref="Span{T}"/> of length <c>69</c> that provides mutable access to the elements of the inline array.
/// A <see cref="Span{T2}"/> of length <c>69</c> that provides mutable access to the elements of the inline array.
/// </returns>
public Span<T2> AsSpan()
=> MemoryMarshal.CreateSpan(ref Unsafe.As<MyInlineArray<T, T2>, T2>(ref this), 69);

/// <summary>
/// Returns a <see cref="ReadOnlySpan{T}"/> that represents the elements of this inline array.
/// Returns a <see cref="ReadOnlySpan{T2}"/> that represents the elements of this inline array.
/// </summary>
/// <returns>
/// A <see cref="ReadOnlySpan{T}"/> of length <c>69</c> that provides read-only access to the elements of the inline array.
/// A <see cref="ReadOnlySpan{T2}"/> of length <c>69</c> that provides read-only access to the elements of the inline array.
/// </returns>
public ReadOnlySpan<T2> AsReadOnlySpan()
=> MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<MyInlineArray<T, T2>, T2>(ref this), 69);

/// <summary>
/// Returns an <see cref="IEnumerable{T}"/> that enumerates the elements of this inline array.
/// Returns an <see cref="IEnumerable{T2}"/> that enumerates the elements of this inline array.
/// </summary>
/// <returns>
/// An <see cref="IEnumerable{T}"/> that iterates over the elements of the inline array in order.
/// An <see cref="IEnumerable{T2}"/> that iterates over the elements of the inline array in order.
/// </returns>
public IEnumerable<T2> AsEnumerable()
{
Expand Down Expand Up @@ -76,14 +76,14 @@ public override int GetHashCode()
}

/// <summary>
/// Creates a new <see cref="MyInlineArray<T, T2>"/> instance and populates it with elements from the specified <see cref="ReadOnlySpan{T}"/> source.
/// Creates a new <see cref="MyInlineArray{T, T2}"/> instance and populates it with elements from the specified <see cref="ReadOnlySpan{T}"/> source.
/// </summary>
/// <param name="source">
/// The sequence of elements to copy into the inline array. If the sequence contains fewer elements than the array's length, the remaining elements are left at their default value.
/// If the sequence contains more elements than the array's length, the extra elements are ignored.
/// </param>
/// <returns>
/// A new <see cref="MyInlineArray<T, T2>"/> instance containing elements from <paramref name="source"/>.
/// A new <see cref="MyInlineArray{T, T2}"/> instance containing elements from <paramref name="source"/>.
/// </returns>
public static MyInlineArray<T, T2> Create(ReadOnlySpan<T2> source)
{
Expand All @@ -92,55 +92,55 @@ public static MyInlineArray<T, T2> Create(ReadOnlySpan<T2> source)
return array;
}

/// <summary>Determines whether two specified instances of <see cref="MyInlineArray<T, T2>"/> are equal by comparing their elements sequence.</summary>
/// <summary>Determines whether two specified instances of <see cref="MyInlineArray{T, T2}"/> are equal by comparing their elements sequence.</summary>
/// <param name="left">The first inline array to compare.</param>
/// <param name="right">The second inline array to compare.</param>
/// <returns><c>true</c> if the arrays are equal; otherwise, <c>false</c>.</returns>
public static bool operator ==(MyInlineArray<T, T2> left, MyInlineArray<T, T2> right)
=> left.Equals(right);

/// <summary>Determines whether two specified instances of <see cref="MyInlineArray<T, T2>"/> are not equal by comparing their elements sequence.</summary>
/// <summary>Determines whether two specified instances of <see cref="MyInlineArray{T, T2}"/> are not equal by comparing their elements sequence.</summary>
/// <param name="left">The first inline array to compare.</param>
/// <param name="right">The second inline array to compare.</param>
/// <returns><c>true</c> if the arrays are not equal; otherwise, <c>false</c>.</returns>
public static bool operator !=(MyInlineArray<T, T2> left, MyInlineArray<T, T2> right)
=> !(left == right);

/// <summary>
/// Implicitly converts an array of <see cref="T2"/> to a <see cref="MyInlineArray<T, T2>"/>.
/// Implicitly converts an array to a <see cref="MyInlineArray{T, T2}"/>.
/// Copies up to <c>69</c> elements from the source array; extra elements are ignored, and missing elements are default-initialized.
/// </summary>
/// <param name="source">
/// The source array to copy elements from. If <paramref name="source"/> is <c>null</c>, a default-initialized <see cref="MyInlineArray<T, T2>"/> is returned.
/// The source array to copy elements from. If <paramref name="source"/> is <c>null</c>, a default-initialized <see cref="MyInlineArray{T, T2}"/> is returned.
/// </param>
/// <returns>
/// A <see cref="MyInlineArray<T, T2>"/> containing elements from <paramref name="source"/>.
/// A <see cref="MyInlineArray{T, T2}"/> containing elements from <paramref name="source"/>.
/// </returns>
public static implicit operator MyInlineArray<T, T2>(T2[] source)
=> source is null ? new() : Create(source);

/// <summary>
/// Implicitly converts a <see cref="ReadOnlySpan{T}"/> of <see cref="T2"/> to a <see cref="MyInlineArray<T, T2>"/>.
/// Implicitly converts a <see cref="ReadOnlySpan{T2}"/> to a <see cref="MyInlineArray{T, T2}"/>.
/// Copies up to <c>69</c> elements from the source span; extra elements are ignored, and missing elements are default-initialized.
/// </summary>
/// <param name="source">
/// The source span to copy elements from.
/// </param>
/// <returns>
/// A <see cref="MyInlineArray<T, T2>"/> containing elements from <paramref name="source"/>.
/// A <see cref="MyInlineArray{T, T2}"/> containing elements from <paramref name="source"/>.
/// </returns>
public static implicit operator MyInlineArray<T, T2>(ReadOnlySpan<T2> source)
=> Create(source);

/// <summary>
/// Implicitly converts a <see cref="Span{T}"/> of <see cref="T2"/> to a <see cref="MyInlineArray<T, T2>"/>.
/// Implicitly converts a <see cref="Span{T2}"/> to a <see cref="MyInlineArray{T, T2}"/>.
/// Copies up to <c>69</c> elements from the source span; extra elements are ignored, and missing elements are default-initialized.
/// </summary>
/// <param name="source">
/// The source span to copy elements from.
/// </param>
/// <returns>
/// A <see cref="MyInlineArray<T, T2>"/> containing elements from <paramref name="source"/>.
/// A <see cref="MyInlineArray{T, T2}"/> containing elements from <paramref name="source"/>.
/// </returns>
public static implicit operator MyInlineArray<T, T2>(Span<T2> source)
=> Create(source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
public AutoInlineArrayAttribute(int length, Type? elementType = null)
{
if (length <= 0)
Expand Down
Loading
Loading