Skip to content

Commit

Permalink
reword deprecation notice
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomocavalieri committed Nov 12, 2024
1 parent e548f30 commit 6a40430
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
28 changes: 14 additions & 14 deletions src/gleam/bytes_builder.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub opaque type BytesBuilder {
/// Create an empty `BytesBuilder`. Useful as the start of a pipe chaining many
/// builders together.
///
@deprecated("This module has been deprecated, use `bytes_tree.new` instead.")
@deprecated("The `bytes_builder` module has been deprecated, use `bytes_tree.new` instead.")
pub fn new() -> BytesBuilder {
concat([])
}
Expand All @@ -42,7 +42,7 @@ pub fn new() -> BytesBuilder {
///
/// Runs in constant time.
///
@deprecated("This module has been deprecated, use `bytes_tree.prepend` instead.")
@deprecated("The `bytes_builder` module has been deprecated, use `bytes_tree.prepend` instead.")
pub fn prepend(to second: BytesBuilder, prefix first: BitArray) -> BytesBuilder {
append_builder(from_bit_array(first), second)
}
Expand All @@ -51,7 +51,7 @@ pub fn prepend(to second: BytesBuilder, prefix first: BitArray) -> BytesBuilder
///
/// Runs in constant time.
///
@deprecated("This module has been deprecated, use `bytes_tree.append` instead.")
@deprecated("The `bytes_builder` module has been deprecated, use `bytes_tree.append` instead.")
pub fn append(to first: BytesBuilder, suffix second: BitArray) -> BytesBuilder {
append_builder(first, from_bit_array(second))
}
Expand All @@ -60,7 +60,7 @@ pub fn append(to first: BytesBuilder, suffix second: BitArray) -> BytesBuilder {
///
/// Runs in constant time.
///
@deprecated("This module has been deprecated, use `bytes_tree.prepend_tree` instead.")
@deprecated("The `bytes_builder` module has been deprecated, use `bytes_tree.prepend_tree` instead.")
pub fn prepend_builder(
to second: BytesBuilder,
prefix first: BytesBuilder,
Expand All @@ -72,7 +72,7 @@ pub fn prepend_builder(
///
/// Runs in constant time.
///
@deprecated("This module has been deprecated, use `bytes_tree.append_tree` instead.")
@deprecated("The `bytes_builder` module has been deprecated, use `bytes_tree.append_tree` instead.")
@external(erlang, "gleam_stdlib", "iodata_append")
pub fn append_builder(
to first: BytesBuilder,
Expand All @@ -89,7 +89,7 @@ pub fn append_builder(
/// Runs in constant time when running on Erlang.
/// Runs in linear time with the length of the string otherwise.
///
@deprecated("This module has been deprecated, use `bytes_tree.prepend_string` instead.")
@deprecated("The `bytes_builder` module has been deprecated, use `bytes_tree.prepend_string` instead.")
pub fn prepend_string(
to second: BytesBuilder,
prefix first: String,
Expand All @@ -102,7 +102,7 @@ pub fn prepend_string(
/// Runs in constant time when running on Erlang.
/// Runs in linear time with the length of the string otherwise.
///
@deprecated("This module has been deprecated, use `bytes_tree.append_string` instead.")
@deprecated("The `bytes_builder` module has been deprecated, use `bytes_tree.append_string` instead.")
pub fn append_string(
to first: BytesBuilder,
suffix second: String,
Expand All @@ -114,7 +114,7 @@ pub fn append_string(
///
/// Runs in constant time.
///
@deprecated("This module has been deprecated, use `bytes_tree.concat` instead.")
@deprecated("The `bytes_builder` module has been deprecated, use `bytes_tree.concat` instead.")
@external(erlang, "gleam_stdlib", "identity")
pub fn concat(builders: List(BytesBuilder)) -> BytesBuilder {
Many(builders)
Expand All @@ -124,7 +124,7 @@ pub fn concat(builders: List(BytesBuilder)) -> BytesBuilder {
///
/// Runs in constant time.
///
@deprecated("This module has been deprecated, use `bytes_tree.concat_bit_arrays` instead.")
@deprecated("The `bytes_builder` module has been deprecated, use `bytes_tree.concat_bit_arrays` instead.")
@external(erlang, "gleam_stdlib", "identity")
pub fn concat_bit_arrays(bits: List(BitArray)) -> BytesBuilder {
bits
Expand All @@ -137,7 +137,7 @@ pub fn concat_bit_arrays(bits: List(BitArray)) -> BytesBuilder {
/// Runs in constant time when running on Erlang.
/// Runs in linear time otherwise.
///
@deprecated("This module has been deprecated, use `bytes_tree.from_string` instead.")
@deprecated("The `bytes_builder` module has been deprecated, use `bytes_tree.from_string` instead.")
@external(erlang, "gleam_stdlib", "wrap_list")
pub fn from_string(string: String) -> BytesBuilder {
Text(string_builder.from_string(string))
Expand All @@ -148,7 +148,7 @@ pub fn from_string(string: String) -> BytesBuilder {
/// Runs in constant time when running on Erlang.
/// Runs in linear time otherwise.
///
@deprecated("This module has been deprecated, use `bytes_tree.from_string_tree` instead.")
@deprecated("The `bytes_builder` module has been deprecated, use `bytes_tree.from_string_tree` instead.")
@external(erlang, "gleam_stdlib", "wrap_list")
pub fn from_string_builder(builder: StringBuilder) -> BytesBuilder {
Text(builder)
Expand All @@ -158,7 +158,7 @@ pub fn from_string_builder(builder: StringBuilder) -> BytesBuilder {
///
/// Runs in constant time.
///
@deprecated("This module has been deprecated, use `bytes_tree.from_bit_array` instead.")
@deprecated("The `bytes_builder` module has been deprecated, use `bytes_tree.from_bit_array` instead.")
@external(erlang, "gleam_stdlib", "wrap_list")
pub fn from_bit_array(bits: BitArray) -> BytesBuilder {
Bytes(bits)
Expand All @@ -171,7 +171,7 @@ pub fn from_bit_array(bits: BitArray) -> BytesBuilder {
/// When running on Erlang this function is implemented natively by the
/// virtual machine and is highly optimised.
///
@deprecated("This module has been deprecated, use `bytes_tree.to_bit_array` instead.")
@deprecated("The `bytes_builder` module has been deprecated, use `bytes_tree.to_bit_array` instead.")
@external(erlang, "erlang", "list_to_bitstring")
pub fn to_bit_array(builder: BytesBuilder) -> BitArray {
[[builder]]
Expand Down Expand Up @@ -206,7 +206,7 @@ fn to_list(
///
/// Runs in linear time.
///
@deprecated("This module has been deprecated, use `bytes_tree.byte_size` instead.")
@deprecated("The `bytes_builder` module has been deprecated, use `bytes_tree.byte_size` instead.")
@external(erlang, "erlang", "iolist_size")
pub fn byte_size(builder: BytesBuilder) -> Int {
[[builder]]
Expand Down
36 changes: 18 additions & 18 deletions src/gleam/string_builder.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub type StringBuilder
/// Create an empty `StringBuilder`. Useful as the start of a pipe chaining many
/// builders together.
///
@deprecated("This module has been deprecated, use `string_tree.new` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.new` instead.")
pub fn new() -> StringBuilder {
do_from_strings([])
}
Expand All @@ -30,7 +30,7 @@ pub fn new() -> StringBuilder {
///
/// Runs in constant time.
///
@deprecated("This module has been deprecated, use `string_tree.prepend` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.prepend` instead.")
pub fn prepend(
to builder: StringBuilder,
prefix prefix: String,
Expand All @@ -42,7 +42,7 @@ pub fn prepend(
///
/// Runs in constant time.
///
@deprecated("This module has been deprecated, use `string_tree.append` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.append` instead.")
pub fn append(to builder: StringBuilder, suffix second: String) -> StringBuilder {
append_builder(builder, from_string(second))
}
Expand All @@ -51,7 +51,7 @@ pub fn append(to builder: StringBuilder, suffix second: String) -> StringBuilder
///
/// Runs in constant time.
///
@deprecated("This module has been deprecated, use `string_tree.prepend_tree` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.prepend_tree` instead.")
pub fn prepend_builder(
to builder: StringBuilder,
prefix prefix: StringBuilder,
Expand All @@ -63,7 +63,7 @@ pub fn prepend_builder(
///
/// Runs in constant time.
///
@deprecated("This module has been deprecated, use `string_tree.append_tree` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.append_tree` instead.")
pub fn append_builder(
to builder: StringBuilder,
suffix suffix: StringBuilder,
Expand All @@ -79,7 +79,7 @@ fn do_append(a: StringBuilder, b: StringBuilder) -> StringBuilder
///
/// Runs in constant time.
///
@deprecated("This module has been deprecated, use `string_tree.from_strings` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.from_strings` instead.")
pub fn from_strings(strings: List(String)) -> StringBuilder {
do_from_strings(strings)
}
Expand All @@ -92,7 +92,7 @@ fn do_from_strings(a: List(String)) -> StringBuilder
///
/// Runs in constant time.
///
@deprecated("This module has been deprecated, use `string_tree.concat` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.concat` instead.")
pub fn concat(builders: List(StringBuilder)) -> StringBuilder {
do_concat(builders)
}
Expand All @@ -105,7 +105,7 @@ fn do_concat(builders: List(StringBuilder)) -> StringBuilder
///
/// Runs in constant time.
///
@deprecated("This module has been deprecated, use `string_tree.from_string` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.from_string` instead.")
pub fn from_string(string: String) -> StringBuilder {
do_from_string(string)
}
Expand All @@ -119,7 +119,7 @@ fn do_from_string(string: String) -> StringBuilder
/// This function is implemented natively by the virtual machine and is highly
/// optimised.
///
@deprecated("This module has been deprecated, use `string_tree.to_string` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.to_string` instead.")
pub fn to_string(builder: StringBuilder) -> String {
do_to_string(builder)
}
Expand All @@ -130,7 +130,7 @@ fn do_to_string(builder: StringBuilder) -> String

/// Returns the size of the `StringBuilder` in bytes.
///
@deprecated("This module has been deprecated, use `string_tree.byte_size` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.byte_size` instead.")
pub fn byte_size(builder: StringBuilder) -> Int {
do_byte_size(builder)
}
Expand All @@ -141,7 +141,7 @@ fn do_byte_size(builder: StringBuilder) -> Int

/// Joins the given builders into a new builder separated with the given string
///
@deprecated("This module has been deprecated, use `string_tree.join` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.join` instead.")
pub fn join(builders: List(StringBuilder), with sep: String) -> StringBuilder {
builders
|> list.intersperse(from_string(sep))
Expand All @@ -151,7 +151,7 @@ pub fn join(builders: List(StringBuilder), with sep: String) -> StringBuilder {
/// Converts a builder to a new builder where the contents have been
/// lowercased.
///
@deprecated("This module has been deprecated, use `string_tree.lowercase` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.lowercase` instead.")
pub fn lowercase(builder: StringBuilder) -> StringBuilder {
do_lowercase(builder)
}
Expand All @@ -163,7 +163,7 @@ fn do_lowercase(builder: StringBuilder) -> StringBuilder
/// Converts a builder to a new builder where the contents have been
/// uppercased.
///
@deprecated("This module has been deprecated, use `string_tree.uppercase` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.uppercase` instead.")
pub fn uppercase(builder: StringBuilder) -> StringBuilder {
do_uppercase(builder)
}
Expand All @@ -174,7 +174,7 @@ fn do_uppercase(builder: StringBuilder) -> StringBuilder

/// Converts a builder to a new builder with the contents reversed.
///
@deprecated("This module has been deprecated, use `string_tree.reverse` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.reverse` instead.")
pub fn reverse(builder: StringBuilder) -> StringBuilder {
do_reverse(builder)
}
Expand All @@ -193,7 +193,7 @@ fn do_to_graphemes(string: String) -> List(String)

/// Splits a builder on a given pattern into a list of builders.
///
@deprecated("This module has been deprecated, use `string_tree.split` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.split` instead.")
pub fn split(iodata: StringBuilder, on pattern: String) -> List(StringBuilder) {
do_split(iodata, pattern)
}
Expand All @@ -212,7 +212,7 @@ fn erl_split(a: StringBuilder, b: String, c: Direction) -> List(StringBuilder)

/// Replaces all instances of a pattern with a given string substitute.
///
@deprecated("This module has been deprecated, use `string_tree.replace` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.replace` instead.")
@external(erlang, "gleam_stdlib", "string_replace")
@external(javascript, "../gleam_stdlib.mjs", "string_replace")
pub fn replace(
Expand All @@ -239,7 +239,7 @@ pub fn replace(
/// // -> True
/// ```
///
@deprecated("This module has been deprecated, use `string_tree.is_equal` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.is_equal` instead.")
@external(erlang, "string", "equal")
pub fn is_equal(a: StringBuilder, b: StringBuilder) -> Bool {
a == b
Expand All @@ -264,7 +264,7 @@ pub fn is_equal(a: StringBuilder, b: StringBuilder) -> Bool {
/// // -> True
/// ```
///
@deprecated("This module has been deprecated, use `string_tree.is_empty` instead.")
@deprecated("The `string_builder` module has been deprecated, use `string_tree.is_empty` instead.")
@external(erlang, "string", "is_empty")
pub fn is_empty(builder: StringBuilder) -> Bool {
from_string("") == builder
Expand Down

0 comments on commit 6a40430

Please sign in to comment.