Skip to content

Commit e313cd6

Browse files
author
LinkDotNet Bot
committed
Updating to newest release
2 parents 1587fc9 + a768225 commit e313cd6

File tree

14 files changed

+116
-61
lines changed

14 files changed

+116
-61
lines changed

.github/workflows/codeql.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ jobs:
2424
- name: Checkout repository
2525
uses: actions/[email protected]
2626

27-
- uses: actions/setup-dotnet@v4.1.0
27+
- uses: actions/setup-dotnet@v4.2.0
2828
with:
2929
dotnet-version: |
30-
6.0.x
31-
7.0.x
3230
8.0.x
3331
9.0.x
3432

.github/workflows/create-release.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ jobs:
3434
path: ./CHANGELOG.md
3535

3636
- name: Setup dotnet
37-
uses: actions/setup-dotnet@v4.1.0
37+
uses: actions/setup-dotnet@v4.2.0
3838
with:
3939
dotnet-version: |
40-
6.0.x
41-
7.0.x
4240
8.0.x
4341
9.0.x
4442

.github/workflows/docs.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ jobs:
1515
- uses: actions/[email protected]
1616

1717
- name: Setup .NET
18-
uses: actions/setup-dotnet@v4.1.0
18+
uses: actions/setup-dotnet@v4.2.0
1919
with:
2020
dotnet-version: |
21-
6.0.x
22-
7.0.x
2321
8.0.x
2422
9.0.x
2523

.github/workflows/dotnet.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ jobs:
1414
steps:
1515
- uses: actions/[email protected]
1616
- name: Setup .NET
17-
uses: actions/setup-dotnet@v4.1.0
17+
uses: actions/setup-dotnet@v4.2.0
1818
with:
1919
dotnet-version: |
20-
6.0.x
21-
7.0.x
2220
8.0.x
2321
9.0.x
2422

CHANGELOG.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@ All notable changes to **ValueStringBuilder** will be documented in this file. T
66

77
## [Unreleased]
88

9+
## [2.0.0] - 2025-01-12
10+
11+
This is the `v2` release of the **ValueStringBuilder**. There aren't any noticeable breaking changes. Only old framework versions were removed to make further development easier. The API is the same (with new additions) as in `v1`.
12+
13+
### Added
14+
15+
- Added `Append(Rune)` overload
16+
- Added `AppendJoin(Rune, IEnumerable<string?>)` overload
17+
- Added `AppendJoin<T>(Rune, IEnumerable<T>)` overload
18+
19+
### Removed
20+
21+
- Support for `net6.0` and `net7.0` was removed.
22+
23+
### Changed
24+
25+
- Added `OverloadResolutionPriority` for `Span` overload for the ctor to keep the current behavior. Reported by [@nsentinel])(<https://github.com/nsentinel>) in [#210](https://github.com/linkdotnet/StringBuilder/issues/210).
26+
- Optimised `AppendLine(scoped ReadOnlySpan<char>)` by avoiding allocating a new string
27+
- Removed erroneous null check in `AppendJoin<T>(ReadOnlySpan<char>, IEnumerable<T>)`
28+
929
## [1.22.0] - 2024-12-18
1030

1131
### Added
@@ -418,7 +438,8 @@ This release brings extensions to the `ValueStringBuilder` API. For `v1.0` the `
418438

419439
- Initial release
420440

421-
[unreleased]: https://github.com/linkdotnet/StringBuilder/compare/1.22.0...HEAD
441+
[unreleased]: https://github.com/linkdotnet/StringBuilder/compare/2.0.0...HEAD
442+
[2.0.0]: https://github.com/linkdotnet/StringBuilder/compare/1.22.0...2.0.0
422443
[1.22.0]: https://github.com/linkdotnet/StringBuilder/compare/1.21.1...1.22.0
423444
[1.21.1]: https://github.com/linkdotnet/StringBuilder/compare/1.21.0...1.21.1
424445
[1.21.0]: https://github.com/linkdotnet/StringBuilder/compare/1.20.0...1.21.0

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup>
4-
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.3.0.106239">
4+
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.4.0.108396">
55
<PrivateAssets>all</PrivateAssets>
66
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
77
</PackageReference>

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,11 @@ Another benchmark shows that this `ValueStringBuilder` uses less memory when it
7474
```
7575

7676
Checkout the [Benchmark](tests/LinkDotNet.StringBuilder.Benchmarks) for a more detailed comparison and setup.
77+
78+
## Support & Contributing
79+
80+
Thanks to all [contributors](https://github.com/linkdotnet/StringBuilder/graphs/contributors) and people that are creating bug-reports and valuable input:
81+
82+
<a href="https://github.com/linkdotnet/StringBuilder/graphs/contributors">
83+
<img src="https://contrib.rocks/image?repo=linkdotnet/StringBuilder" alt="Supporters" />
84+
</a>

src/LinkDotNet.StringBuilder/LinkDotNet.StringBuilder.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -37,10 +37,11 @@
3737
<EnableNETAnalyzers>true</EnableNETAnalyzers>
3838
<AnalysisLevel>8</AnalysisLevel>
3939
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
40+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
4041
</PropertyGroup>
4142

4243
<ItemGroup>
43-
<PackageReference Include="Meziantou.Analyzer" Version="2.0.182">
44+
<PackageReference Include="Meziantou.Analyzer" Version="2.0.184">
4445
<PrivateAssets>all</PrivateAssets>
4546
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4647
</PackageReference>

src/LinkDotNet.StringBuilder/StringSyntaxAttribute.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/LinkDotNet.StringBuilder/ValueStringBuilder.Append.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Runtime.CompilerServices;
22
using System.Runtime.InteropServices;
3+
using System.Text;
34

45
namespace LinkDotNet.StringBuilder;
56

@@ -117,6 +118,20 @@ public void Append(char value)
117118
bufferPosition++;
118119
}
119120

121+
/// <summary>
122+
/// Appends a single rune to the string builder.
123+
/// </summary>
124+
/// <param name="value">Rune to add.</param>
125+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
126+
public void Append(Rune value)
127+
{
128+
Span<char> valueChars = stackalloc char[2];
129+
int valueCharsWritten = value.EncodeToUtf16(valueChars);
130+
ReadOnlySpan<char> valueCharsReadOnly = valueChars[..valueCharsWritten];
131+
132+
Append(valueCharsReadOnly);
133+
}
134+
120135
/// <summary>
121136
/// Adds the default new line separator.
122137
/// </summary>
@@ -129,11 +144,12 @@ public void AppendLine()
129144
/// <summary>
130145
/// Does the same as <see cref="Append(char)"/> but adds a newline at the end.
131146
/// </summary>
132-
/// <param name="str">String, which will be added to this builder.</param>
147+
/// <param name="str">String to be added to this builder.</param>
133148
[MethodImpl(MethodImplOptions.AggressiveInlining)]
134149
public void AppendLine(scoped ReadOnlySpan<char> str)
135150
{
136-
Append(string.Concat(str, Environment.NewLine));
151+
Append(str);
152+
Append(Environment.NewLine);
137153
}
138154

139155
/// <summary>
@@ -144,7 +160,7 @@ public void AppendLine(scoped ReadOnlySpan<char> str)
144160
[MethodImpl(MethodImplOptions.AggressiveInlining)]
145161
public Span<char> AppendSpan(int length)
146162
{
147-
int origPos = bufferPosition;
163+
var origPos = bufferPosition;
148164
if (origPos > buffer.Length - length)
149165
{
150166
Grow(length);

0 commit comments

Comments
 (0)