Skip to content

Commit 7288ed1

Browse files
hayleigh-dot-devlpil
authored andcommitted
✨ Add new constructors for empty BitStrings and StringBuilers.
1 parent 959115c commit 7288ed1

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/gleam/bit_builder.gleam

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ if javascript {
2828
}
2929
}
3030

31+
/// Create an empty `BitBuilder`. Useful as the start of a pipe chaning many
32+
/// builders together.
33+
///
34+
pub fn new () -> BitBuilder {
35+
do_concat([])
36+
}
37+
3138
/// Prepends a bit string to the start of a builder.
3239
///
3340
/// Runs in constant time.

src/gleam/string_builder.gleam

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
///
1515
pub external type StringBuilder
1616

17+
/// Create an empty `StringBuilder`. Useful as the start of a pipe chaning many
18+
/// builders together.
19+
///
20+
pub fn new() -> StringBuilder {
21+
do_from_strings([])
22+
}
23+
1724
/// Prepends a `String` onto the start of some `StringBuilder`.
1825
///
1926
/// Runs in constant time.

0 commit comments

Comments
 (0)