Skip to content

Commit e862e46

Browse files
chore: enhance documentation and structure of UDP packet classes (#12)
1 parent d58b029 commit e862e46

File tree

132 files changed

+1441
-163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1441
-163
lines changed

F1Game.UDP.SourceGenerator.Tests/snapshots/AutoInlineArrayGeneratorTests.ArrayIsNotPartial_AddsDiagnostic#F1Game.UDP.SourceGenerator.AutoInlineArrayAttribute.Generated.verified.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
3232
{
3333
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
3434
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
35+
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
3536
public AutoInlineArrayAttribute(int length, Type? elementType = null)
3637
{
3738
if (length <= 0)

F1Game.UDP.SourceGenerator.Tests/snapshots/AutoInlineArrayGeneratorTests.ArrayWithField_GeneratesArrayCode#F1Game.UDP.SourceGenerator.AutoInlineArrayAttribute.Generated.verified.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
3232
{
3333
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
3434
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
35+
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
3536
public AutoInlineArrayAttribute(int length, Type? elementType = null)
3637
{
3738
if (length <= 0)

F1Game.UDP.SourceGenerator.Tests/snapshots/AutoInlineArrayGeneratorTests.ArrayWithField_GeneratesArrayCode#MyCode.InlineArray.Generated.verified.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace MyCode;
1111

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

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

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

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

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

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

135135
/// <summary>
136-
/// Implicitly converts a <see cref="Span{T}"/> of <see cref="global::MyCode.Element"/> to a <see cref="InlineArray"/>.
136+
/// Implicitly converts a <see cref="Span{global::MyCode.Element}"/> to a <see cref="InlineArray"/>.
137137
/// Copies up to <c>42</c> elements from the source span; extra elements are ignored, and missing elements are default-initialized.
138138
/// </summary>
139139
/// <param name="source">

F1Game.UDP.SourceGenerator.Tests/snapshots/AutoInlineArrayGeneratorTests.ArrayWithNegativeLength_AddsDiagnostic#F1Game.UDP.SourceGenerator.AutoInlineArrayAttribute.Generated.verified.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
3232
{
3333
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
3434
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
35+
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
3536
public AutoInlineArrayAttribute(int length, Type? elementType = null)
3637
{
3738
if (length <= 0)

F1Game.UDP.SourceGenerator.Tests/snapshots/AutoInlineArrayGeneratorTests.ArrayWithTwoAttributes_AddsDiagnostic#F1Game.UDP.SourceGenerator.AutoInlineArrayAttribute.Generated.verified.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
3232
{
3333
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
3434
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
35+
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
3536
public AutoInlineArrayAttribute(int length, Type? elementType = null)
3637
{
3738
if (length <= 0)

F1Game.UDP.SourceGenerator.Tests/snapshots/AutoInlineArrayGeneratorTests.ArrayWithTwoInstanceFields_AddsDiagnostic#F1Game.UDP.SourceGenerator.AutoInlineArrayAttribute.Generated.verified.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
3232
{
3333
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
3434
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
35+
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
3536
public AutoInlineArrayAttribute(int length, Type? elementType = null)
3637
{
3738
if (length <= 0)

F1Game.UDP.SourceGenerator.Tests/snapshots/AutoInlineArrayGeneratorTests.ArrayWithTypeInAttributeAndField_AddsDiagnostic#F1Game.UDP.SourceGenerator.AutoInlineArrayAttribute.Generated.verified.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
3232
{
3333
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
3434
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
35+
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
3536
public AutoInlineArrayAttribute(int length, Type? elementType = null)
3637
{
3738
if (length <= 0)

F1Game.UDP.SourceGenerator.Tests/snapshots/AutoInlineArrayGeneratorTests.ArrayWithTypeInAttribute_GeneratesArrayCode#F1Game.UDP.SourceGenerator.AutoInlineArrayAttribute.Generated.verified.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
3232
{
3333
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
3434
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
35+
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
3536
public AutoInlineArrayAttribute(int length, Type? elementType = null)
3637
{
3738
if (length <= 0)

F1Game.UDP.SourceGenerator.Tests/snapshots/AutoInlineArrayGeneratorTests.ArrayWithTypeInAttribute_GeneratesArrayCode#MyCode.ByteInlineArray.Generated.verified.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace MyCode;
1111

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

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

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

4545
/// <summary>
46-
/// Returns an <see cref="IEnumerable{T}"/> that enumerates the elements of this inline array.
46+
/// Returns an <see cref="IEnumerable{byte}"/> that enumerates the elements of this inline array.
4747
/// </summary>
4848
/// <returns>
49-
/// An <see cref="IEnumerable{T}"/> that iterates over the elements of the inline array in order.
49+
/// An <see cref="IEnumerable{byte}"/> that iterates over the elements of the inline array in order.
5050
/// </returns>
5151
public IEnumerable<byte> AsEnumerable()
5252
{
@@ -109,7 +109,7 @@ public static ByteInlineArray Create(ReadOnlySpan<byte> source)
109109
=> !(left == right);
110110

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

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

137137
/// <summary>
138-
/// Implicitly converts a <see cref="Span{T}"/> of <see cref="byte"/> to a <see cref="ByteInlineArray"/>.
138+
/// Implicitly converts a <see cref="Span{byte}"/> to a <see cref="ByteInlineArray"/>.
139139
/// Copies up to <c>42</c> elements from the source span; extra elements are ignored, and missing elements are default-initialized.
140140
/// </summary>
141141
/// <param name="source">

F1Game.UDP.SourceGenerator.Tests/snapshots/AutoInlineArrayGeneratorTests.ArrayWithZeroLength_AddsDiagnostic#F1Game.UDP.SourceGenerator.AutoInlineArrayAttribute.Generated.verified.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ internal sealed class AutoInlineArrayAttribute : Attribute
3232
{
3333
/// <summary>Initializes a new instance of the <see cref="AutoInlineArrayAttribute"/> class.</summary>
3434
/// <param name="length">The number of elements in the inline array. Must be greater than 0.</param>
35+
/// <param name="elementType">The type of the element in the inline array. Optional if it can be inferred.</param>
3536
public AutoInlineArrayAttribute(int length, Type? elementType = null)
3637
{
3738
if (length <= 0)

0 commit comments

Comments
 (0)