Bug in io::write_using_write_byte.

This commit is contained in:
Christoffer Lerno
2025-10-05 00:29:34 +02:00
parent b5ae2485a7
commit 1eb8c0ced1
2 changed files with 16 additions and 2 deletions

View File

@@ -116,6 +116,9 @@ macro usz? write_all(stream, char[] buffer)
return n;
}
<*
@require @is_instream(s)
*>
macro usz? read_using_read_byte(s, char[] buffer)
{
usz len = 0;
@@ -133,12 +136,18 @@ macro usz? read_using_read_byte(s, char[] buffer)
return len;
}
<*
@require @is_outstream(s)
*>
macro void? write_byte_using_write(s, char c)
{
char[1] buff = { c };
s.write(&buff)!;
}
<*
@require @is_instream(s)
*>
macro char? read_byte_using_read(s)
{
char[1] buffer;
@@ -149,10 +158,12 @@ macro char? read_byte_using_read(s)
alias ReadByteFn = fn char?();
<*
@require @is_outstream(s)
*>
macro usz? write_using_write_byte(s, char[] bytes)
{
foreach (c : bytes) s.write_byte(self, c)!;
foreach (c : bytes) s.write_byte(c)!;
return bytes.len;
}

View File

@@ -3,7 +3,10 @@
## 0.7.7 Change list
### Changes / improvements
### Fixes
- Bug in `io::write_using_write_byte`.
### Stdlib changes
## 0.7.6 Change list