diff options
author | Louis Pilfold <louis@lpil.uk> | 2020-05-29 21:06:31 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2020-05-29 21:06:31 +0100 |
commit | f88c132f3407f85a4580968d149c0f53a50d06b6 (patch) | |
tree | dc7d85f95c00dac365ef3e6eb022b7a4e5505d90 | |
parent | 692a60c412ee61a440b28316ecf02b0c3a25b90a (diff) | |
download | gleam_stdlib-f88c132f3407f85a4580968d149c0f53a50d06b6.tar.gz gleam_stdlib-f88c132f3407f85a4580968d149c0f53a50d06b6.zip |
Correct doc comment
-rw-r--r-- | src/gleam/binary.gleam | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/gleam/binary.gleam b/src/gleam/binary.gleam index d830273..a469403 100644 --- a/src/gleam/binary.gleam +++ b/src/gleam/binary.gleam @@ -1,13 +1,16 @@ //// Working with raw binary data. -//// The Binary type should be used instead of a String type when not utf8 encoded. +//// The Binary type should be used instead of a String type when not utf8 +//// encoded. pub external type Binary /// Convert a utf8 String type into a raw Binary type. +/// pub external fn from_string(String) -> Binary = "gleam_stdlib" "identity" /// Returns an integer which is the number of bytes in the binary. +/// pub external fn byte_size(Binary) -> Int = "erlang" "byte_size" @@ -15,16 +18,18 @@ pub external fn byte_size(Binary) -> Int = /// /// ## Examples /// -/// > append(to: "butter", suffix: "fly") -/// "butterfly" +/// > append(to: from_string("butter"), suffix: from_string("fly")) +/// from_string("butterfly") /// pub external fn append(first: Binary, second: Binary) -> Binary = "gleam_stdlib" "binary_append" /// Extracts part of a binary. /// -/// Binary part will start at given position and continue up to specified length. -/// A negative length can be used to extract bytes at the end of a binary: +/// Binary part will start at given position and continue up to specified +/// length. +/// A negative length can be used to extract bytes at the end of a binary. +/// pub external fn part( string: Binary, position: Int, @@ -34,12 +39,15 @@ pub external fn part( /// Convert an integer to unsigned 32 bits. /// -/// Returns an error if integer is less than zero or equal to or larger than 2^32. +/// Returns an error if integer is less than zero or equal to or larger than +/// 2^32. +/// pub external fn int_to_u32(Int) -> Result(Binary, Nil) = "gleam_stdlib" "binary_int_to_u32" -/// Convert unsigned 32 bits to an integer +/// Convert unsigned 32 bits to an integer. /// /// Returns an error if the binary is not 32 bits in length. +/// pub external fn int_from_u32(Binary) -> Result(Int, Nil) = "gleam_stdlib" "binary_int_from_u32" |