Skip to content

Commit fc3b9d5

Browse files
committed
Add disclaimer on bytearray.to_string
1 parent 2725b16 commit fc3b9d5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/aiken/bytearray.ak

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,14 @@ test take_4() {
387387

388388
/// Convert a `ByteArray` into a `String`.
389389
///
390+
/// <br/>⚠️<pre>WARNING</pre> | This functions fails if the underlying `ByteArray` isn't UTF-8-encoded. <br/>In particular, you cannot convert arbitrary hash digests using this function. <br/>For converting arbitrary `ByteArray`s, use [bytearray.to_hex](#to_hex).
391+
/// --- | ---
392+
///
393+
///
390394
/// ```aiken
391395
/// bytearray.to_string(#"414243") == "ABC"
396+
///
397+
/// bytearray.to_string(some_hash) -> fail
392398
/// ```
393399
pub fn to_string(self: ByteArray) -> String {
394400
builtin.decode_utf8(self)

0 commit comments

Comments
 (0)