1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-22 01:08:48 +00:00

refactor!: remove Span<T>.Split

This commit is contained in:
Oliver Booth 2024-11-13 18:22:36 +00:00
parent 9d870b2c24
commit 0b978f5cdf
Signed by: oliverbooth
GPG Key ID: 2A862C3F46178E8E
3 changed files with 16 additions and 2 deletions

View File

@ -5,7 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## 4.0.0 - [Unreleased] ## 4.0.1 - [Unreleased]
### Removed
- X10D: Removed `Span<T>.Split` for .NET 9.0 target due to conflicts with
[`System.MemoryExtensions.Split`](https://learn.microsoft.com/en-us/dotnet/api/system.memoryextensions.split?view=net-8.0).
## [4.0.0] - 2024-06-12
### Added ### Added
@ -642,7 +649,8 @@ please [open an issue](https://github.com/oliverbooth/X10D/issues)!
Earlier versions of this package are undocumented and unlisted from package results. Earlier versions of this package are undocumented and unlisted from package results.
[unreleased]: https://github.com/oliverbooth/X10D/compare/v3.3.1...main [unreleased]: https://github.com/oliverbooth/X10D/compare/v4.0.0...main
[4.0.0]: https://github.com/oliverbooth/X10D/releases/tag/v4.0.0
[3.3.1]: https://github.com/oliverbooth/X10D/releases/tag/v3.3.1 [3.3.1]: https://github.com/oliverbooth/X10D/releases/tag/v3.3.1
[3.3.0]: https://github.com/oliverbooth/X10D/releases/tag/v3.3.0 [3.3.0]: https://github.com/oliverbooth/X10D/releases/tag/v3.3.0
[3.2.2]: https://github.com/oliverbooth/X10D/releases/tag/v3.2.2 [3.2.2]: https://github.com/oliverbooth/X10D/releases/tag/v3.2.2

View File

@ -1,5 +1,7 @@
using NUnit.Framework; using NUnit.Framework;
#if !NET9_0_OR_GREATER
using X10D.Collections; using X10D.Collections;
#endif
namespace X10D.Tests.Collections; namespace X10D.Tests.Collections;
@ -70,6 +72,7 @@ internal class SpanTest
Assert.That(span.ToArray(), Is.EqualTo(new[] {1, 2, 3, 2, 5, 2, 7, 2, 9, 2, 11, 2, 13, 2, 15, 2})); Assert.That(span.ToArray(), Is.EqualTo(new[] {1, 2, 3, 2, 5, 2, 7, 2, 9, 2, 11, 2, 13, 2, 15, 2}));
} }
#if !NET9_0_OR_GREATER
[Test] [Test]
public void Split_OnEmptySpan_ShouldYieldNothing_UsingCharDelimiter_GivenReadOnlySpan() public void Split_OnEmptySpan_ShouldYieldNothing_UsingCharDelimiter_GivenReadOnlySpan()
{ {
@ -497,4 +500,5 @@ internal class SpanTest
Assert.That(index, Is.EqualTo(3)); Assert.That(index, Is.EqualTo(3));
} }
#endif
} }

View File

@ -75,6 +75,7 @@ public static class SpanExtensions
} }
#endif #endif
#if !NET9_0_OR_GREATER
/// <summary> /// <summary>
/// Splits a span of elements into sub-spans based on a delimiting element. /// Splits a span of elements into sub-spans based on a delimiting element.
/// </summary> /// </summary>
@ -134,4 +135,5 @@ public static class SpanExtensions
{ {
return new SpanSplitEnumerator<T>(source, delimiter); return new SpanSplitEnumerator<T>(source, delimiter);
} }
#endif
} }