Add RentedSeStringBuilder

Co-authored-by: Soreepeong <3614868+Soreepeong@users.noreply.github.com>
This commit is contained in:
Haselnussbomber 2025-10-08 03:41:31 +02:00
parent 4ac4505d72
commit 9852feaf08
No known key found for this signature in database
GPG key ID: BB905BB49E7295D1

View file

@ -0,0 +1,19 @@
using Lumina.Text;
namespace Dalamud.Utility;
/// <summary>
/// Provides a temporarily rented <see cref="SeStringBuilder"/> from a shared pool.
/// </summary>
public readonly struct RentedSeStringBuilder() : IDisposable
{
/// <summary>
/// Gets the rented <see cref="SeStringBuilder"/> value from the shared pool.
/// </summary>
public SeStringBuilder Builder { get; } = SeStringBuilder.SharedPool.Get();
/// <summary>
/// Returns the rented <see cref="SeStringBuilder"/> to the shared pool.
/// </summary>
public void Dispose() => SeStringBuilder.SharedPool.Return(this.Builder);
}