-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df928dc
commit b340a2a
Showing
5 changed files
with
319 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
from .bufio import Reader, Writer, ReadWriter | ||
from .reader import Reader | ||
from .writer import Writer | ||
from .read_writer import ReadWriter | ||
from .scan import Scanner, scan_words, scan_bytes, scan_lines, scan_runes | ||
|
||
|
||
alias MIN_READ_BUFFER_SIZE = 16 | ||
alias MAX_CONSECUTIVE_EMPTY_READS = 100 | ||
|
||
alias ERR_INVALID_UNREAD_BYTE = "bufio: invalid use of unread_byte" | ||
alias ERR_INVALID_UNREAD_RUNE = "bufio: invalid use of unread_rune" | ||
alias ERR_BUFFER_FULL = "bufio: buffer full" | ||
alias ERR_NEGATIVE_COUNT = "bufio: negative count" | ||
alias ERR_NEGATIVE_READ = "bufio: reader returned negative count from Read" | ||
alias ERR_NEGATIVE_WRITE = "bufio: writer returned negative count from write" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from .reader import Reader | ||
from .writer import Writer | ||
|
||
|
||
# buffered input and output | ||
struct ReadWriter[R: io.Reader, W: io.Writer](): | ||
"""ReadWriter has both a buffered reader and writer.""" | ||
|
||
var reader: Reader[R] | ||
var writer: Writer[W] | ||
|
||
fn __init__(inout self, owned reader: R, owned writer: W): | ||
self.reader = Reader(reader^) | ||
self.writer = Writer(writer^) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.