Skip to content

Commit

Permalink
Rename FixedAppender to InPlaceAppender
Browse files Browse the repository at this point in the history
  • Loading branch information
0xEAB committed Jan 18, 2025
1 parent da25da5 commit 1057b31
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions std/array.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
}

Expand Down Expand Up @@ -3651,15 +3651,15 @@ 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);
}

// Const fixing hack.
void put(Range)(Range items)
if (FixedAppender!A.canPutConstRange!Range)
if (InPlaceAppender!A.canPutConstRange!Range)
{
if (!items.empty)
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
}
}
Expand All @@ -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;
Expand All @@ -3789,7 +3789,7 @@ if (isDynamicArray!A)
bool tryExtendBlock = false;
}

@disable this(ref FixedAppender);
@disable this(ref InPlaceAppender);

this(A arrIn) @trusted
{
Expand Down Expand Up @@ -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)));
}

/**
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

/++
Expand Down

0 comments on commit 1057b31

Please sign in to comment.