From 1057b3189a36a624f71f90162d25dcd2077d8157 Mon Sep 17 00:00:00 2001 From: Elias Batek Date: Sun, 19 Jan 2025 00:21:17 +0100 Subject: [PATCH] Rename `FixedAppender` to `InPlaceAppender` --- std/array.d | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/std/array.d b/std/array.d index 5739f9de72b..f3d8568e79e 100644 --- a/std/array.d +++ b/std/array.d @@ -3575,7 +3575,7 @@ if (isDynamicArray!A) private alias T = ElementEncodingType!A; - FixedAppender!A* impl; + InPlaceAppender!A* impl; /** * Constructs an `Appender` with a given array. Note that this does not copy the @@ -3585,14 +3585,14 @@ if (isDynamicArray!A) */ this(A arr) @safe { - impl = new FixedAppender!A(arr); + impl = new InPlaceAppender!A(arr); } private void ensureInit() @safe { if (impl is null) { - impl = new FixedAppender!A; + impl = new InPlaceAppender!A; } } @@ -3651,7 +3651,7 @@ if (isDynamicArray!A) * item = the single item to append */ void put(U)(U item) - if (FixedAppender!A.canPutItem!U) + if (InPlaceAppender!A.canPutItem!U) { ensureInit(); impl.put(item); @@ -3659,7 +3659,7 @@ if (isDynamicArray!A) // Const fixing hack. void put(Range)(Range items) - if (FixedAppender!A.canPutConstRange!Range) + if (InPlaceAppender!A.canPutConstRange!Range) { if (!items.empty) { @@ -3676,7 +3676,7 @@ if (isDynamicArray!A) * items = the range of items to append */ void put(Range)(Range items) - if (FixedAppender!A.canPutRange!Range) + if (InPlaceAppender!A.canPutRange!Range) { if (!items.empty) { @@ -3744,7 +3744,7 @@ if (isDynamicArray!A) */ string toString()() const { - return FixedAppender!A.toStringImpl(Unqual!(typeof(this)).stringof, impl ? impl.data : null); + return InPlaceAppender!A.toStringImpl(Unqual!(typeof(this)).stringof, impl ? impl.data : null); } /// ditto @@ -3753,7 +3753,7 @@ if (isDynamicArray!A) { void toString(scope ref Writer w, scope const ref FormatSpec!char fmt) const { - FixedAppender!A.toStringImpl(Unqual!(typeof(this)).stringof, impl ? impl.data : null, w, fmt); + InPlaceAppender!A.toStringImpl(Unqual!(typeof(this)).stringof, impl ? impl.data : null, w, fmt); } } } @@ -3774,7 +3774,7 @@ if (isDynamicArray!A) assert(app2[] == [ 1, 2, 3, 4, 5, 6 ]); } -package(std) struct FixedAppender(A) +package(std) struct InPlaceAppender(A) if (isDynamicArray!A) { import core.memory : GC; @@ -3789,7 +3789,7 @@ if (isDynamicArray!A) bool tryExtendBlock = false; } - @disable this(ref FixedAppender); + @disable this(ref InPlaceAppender); this(A arrIn) @trusted { @@ -3931,13 +3931,13 @@ if (isDynamicArray!A) enum bool canPutConstRange = isInputRange!(Unqual!Range) && !isInputRange!Range && - is(typeof(FixedAppender.init.put(Range.init.front))); + is(typeof(InPlaceAppender.init.put(Range.init.front))); } private template canPutRange(Range) { enum bool canPutRange = isInputRange!Range && - is(typeof(FixedAppender.init.put(Range.init.front))); + is(typeof(InPlaceAppender.init.put(Range.init.front))); } /** @@ -4110,7 +4110,7 @@ if (isDynamicArray!A) { import std.format.spec : singleSpec; - FixedAppender!string app; + InPlaceAppender!string app; auto spec = singleSpec("%s"); immutable len = arr.length; // different reserve lengths because each element in a @@ -4459,21 +4459,21 @@ unittest } /++ - Convenience function that returns a $(LREF FixedAppender) instance, + Convenience function that returns a $(LREF InPlaceAppender) instance, optionally initialized with `array`. +/ -package(std) FixedAppender!A fixedAppender(A)() +package(std) InPlaceAppender!A inPlaceAppender(A)() if (isDynamicArray!A) { - return FixedAppender!A(null); + return InPlaceAppender!A(null); } /// ditto -package(std) FixedAppender!(E[]) fixedAppender(A : E[], E)(auto ref A array) +package(std) InPlaceAppender!(E[]) inPlaceAppender(A : E[], E)(auto ref A array) { static assert(!isStaticArray!A || __traits(isRef, array), - "Cannot create FixedAppender from an rvalue static array"); + "Cannot create InPlaceAppender from an rvalue static array"); - return FixedAppender!(E[])(array); + return InPlaceAppender!(E[])(array); } /++