aboutsummaryrefslogtreecommitdiff
path: root/lib/std/io
AgeCommit message (Collapse)Author
2025-07-11std: rename `io` to `Io` in preparationAndrew Kelley
This commit is non-breaking. std.io is deprecated in favor of std.Io, in preparation for that namespace becoming an interface.
2025-07-09std.io.Writer: remove some unimplemented functionsAndrew Kelley
YAGNI
2025-07-09std.io.Writer.writeStructEndian: fix packed structsAndrew Kelley
2025-07-09std.io.Writer.writeSplatHeader: fix splat alias bugAndrew Kelley
pointer comparison cannot be used since the buffers may alias
2025-07-09std.io.Writer.writeSplat: simplify and fixAndrew Kelley
2025-07-09std.io.Reader: make vtable contract more consistentAndrew Kelley
2025-07-09std.io.Reader.peekDelimiterInclusive: simplify and fixAndrew Kelley
2025-07-09std: fmt.format to io.Writer.printAndrew Kelley
allows reverting format -> deprecatedFormat, plus I think this is a nicer place for the function.
2025-07-09chicken out and allow ascii string alignmentAndrew Kelley
2025-07-09std: forbid alignment formatting options sometimesAndrew Kelley
2025-07-09std: replace formatInteger with formatNumberAndrew Kelley
2025-07-09eliminate all uses of std.io.Writer.count except for CBEAndrew Kelley
2025-07-07std.io.Writer.VectorWrapper: fix vtable not being a unique addrAndrew Kelley
2025-07-07update standalone and incremental tests to new APIAndrew Kelley
2025-07-07fix 32-bit compilationAndrew Kelley
2025-07-07std.io.Reader: fix peekByteAndrew Kelley
2025-07-07fix std.io.Writer.VectorWrapper mechanismAndrew Kelley
previous implementation erroneously attempted to detect whether vector API was used via the buffer pointer. This implementation has an explicit flag.
2025-07-07std.io.Writer.printValue: rework logicAndrew Kelley
Alignment and fill options only apply to numbers. Rework the implementation to mainly branch on the format string rather than the type information. This is more straightforward to maintain and more straightforward for comptime evaluation. Enums support being printed as decimal, hexadecimal, octal, and binary. `formatInteger` is another possible format method that is unconditionally called when the value type is struct and one of the integer-printing format specifiers are used.
2025-07-07std.fmt: fully remove format string from format methodsAndrew Kelley
Introduces `std.fmt.alt` which is a helper for calling alternate format methods besides one named "format".
2025-07-07std.fmt.format: use {t} for tag name rather than {s}Andrew Kelley
prevents footgun when formatted type changes from string to enum
2025-07-07compiler: update a bunch of format stringsAndrew Kelley
2025-07-07compiler: fix a bunch of format stringsAndrew Kelley
2025-07-07fix build runnerAndrew Kelley
2025-07-07compiler: upgrade various std.io API usageAndrew Kelley
2025-07-07update compiler source to new APIsAndrew Kelley
2025-07-07std.io.Writer.Allocating: rename interface to writerAndrew Kelley
2025-07-07std.io.Reader: fix appendRemainingAndrew Kelley
2025-07-07std.io.Reader: finish implementing the unit testsAndrew Kelley
2025-07-07std.io.Writer.Allocating: extra ensure byteAndrew Kelley
So that when returning from drain there is always capacity for at least one more byte.
2025-07-07std.io.Reader: fix fill implementationAndrew Kelley
now it avoids writing to buffer in the case of fixed
2025-07-07std.io.Reader: add doctest for streamDelimiterLimitAndrew Kelley
2025-07-07std.io.Reader: fix streamDelimiter and streamDelimiterEndingAndrew Kelley
2025-07-07std: formatted printing no longer prints type namesAndrew Kelley
for structs, enums, and unions. auto untagged unions are no longer printed as pointers; instead they are printed as "{ ... }". extern and packed untagged unions have each field printed, similar to what gdb does. also fix bugs in delimiter based reading
2025-07-07std.fmt: breaking API changesAndrew Kelley
added adapter to AnyWriter and GenericWriter to help bridge the gap between old and new API make std.testing.expectFmt work at compile-time std.fmt no longer has a dependency on std.unicode. Formatted printing was never properly unicode-aware. Now it no longer pretends to be. Breakage/deprecations: * std.fs.File.reader -> std.fs.File.deprecatedReader * std.fs.File.writer -> std.fs.File.deprecatedWriter * std.io.GenericReader -> std.io.Reader * std.io.GenericWriter -> std.io.Writer * std.io.AnyReader -> std.io.Reader * std.io.AnyWriter -> std.io.Writer * std.fmt.format -> std.fmt.deprecatedFormat * std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape * std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape * std.fmt.fmtSliceHexLower -> {x} * std.fmt.fmtSliceHexUpper -> {X} * std.fmt.fmtIntSizeDec -> {B} * std.fmt.fmtIntSizeBin -> {Bi} * std.fmt.fmtDuration -> {D} * std.fmt.fmtDurationSigned -> {D} * {} -> {f} when there is a format method * format method signature - anytype -> *std.io.Writer - inferred error set -> error{WriteFailed} - options -> (deleted) * std.fmt.Formatted - now takes context type explicitly - no fmt string
2025-07-07std.io: deprecated Reader/Writer; introduce new APIAndrew Kelley
2025-04-13std: eradicate u29 and embrace std.mem.AlignmentAndrew Kelley
2025-03-24lib/std: PermissionDenied/AccessDenied cleanup and falloutPat Tullmann
This PR consistently maps .ACCES into AccessDenied and .PERM into PermissionDenied. AccessDenied is returned if the file mode bit (user/group/other rwx bits) disallow access (errno was `EACCES`). PermissionDenied is returned if something else denies access (errno was `EPERM`) (immutable bit, SELinux, capabilities, etc). This somewhat subtle distinction is a POSIX thing. Most of the change is updating std.posix Error Sets to contain both errors, and then propagating the pair up through caller Error Sets. Fixes #16782
2025-03-09std/lib: {fs,io,posix} test clean upPat Tullmann
* use `tmp.dir.realpathAlloc()` to get full path into tmpDir instances * use `testing.allocator` where that simplifies things (vs. manual ArenaAllocator for 1 or 2 allocs) * Trust `TmpDir.cleanup()` to clean up contained files and sub-trees * Remove some unnecessary absolute paths (enabling WASI to run the tests) * Drop some no-longer necessary `[_][]const u8` casts * Add scopes to reduce `var` usage in favor of `const`
2025-02-06std.process: adding hasNonEmptyEnvVar() and using for NO_COLORJohn Benediktsson
2025-01-16all: update to `std.builtin.Type.Pointer.Size` field renamesmlugg
This was done by regex substitution with `sed`. I then manually went over the entire diff and fixed any incorrect changes. This diff also changes a lot of `callconv(.C)` to `callconv(.c)`, since my regex happened to also trigger here. I opted to leave these changes in, since they *are* a correct migration, even if they're not the one I was trying to do!
2024-10-13Rewrite bit_reader and bit_writer to take advantage of current zig semantics ↵tgschultz
and enhance readability (#21689) Co-authored-by: Tanner Schultz <tgschultz@tgschultz-dl.tail7ba92.ts.net>
2024-09-26std.io.Reader: Fix test erroneously using undefined.Alex Rønne Petersen
2024-09-23Improve efficiency of buffered_reader. (#21256)Lucas Santos
The previous implementation of buffered_reader always reads from the unbuffered reader into the internal buffer, and then dumps the data onto the destination. This is inefficient, as sometimes it's possible to read directly into the destination. The previous strategy generates more memory copies and unbuffered reads than necessary.
2024-08-28std: update `std.builtin.Type` fields to follow naming conventionsmlugg
The compiler actually doesn't need any functional changes for this: Sema does reification based on the tag indices of `std.builtin.Type` already! So, no zig1.wasm update is necessary. This change is necessary to disallow name clashes between fields and decls on a type, which is a prerequisite of #9938.
2024-07-25implement std.testing.fuzzInputAndrew Kelley
for the -fno-fuzz case. The other case will take more work in libfuzzer.
2024-06-02Add `File.getOrEnableAnsiEscapeSupport` and use itRyan Liptak
On Windows, the console mode flag `ENABLE_VIRTUAL_TERMINAL_PROCESSING` determines whether or not ANSI escape codes are parsed/acted on. On the newer Windows Terminal, this flag is set by default, but on the older Windows Console, it is not set by default, but *can* be enabled (since Windows 10 RS1 from June 2016). The new `File.getOrEnableAnsiEscapeSupport` function will get the current status of ANSI escape code support, but will also attempt to enable `ENABLE_VIRTUAL_TERMINAL_PROCESSING` on Windows if necessary which will provide better/more consistent results for things like `std.Progress` and `std.io.tty`. This type of change was not done previously due to a mistaken assumption (on my part) that the console mode would persist after the run of a program. However, it turns out that the console mode is always reset to the default for each program run in a console session.
2024-06-02Replace YES_COLOR with CLICOLOR_FORCECarl Åstholm
Instead of introducing YES_COLOR, a completely new standard, into the mix it might make more sense to instead tag along with the CLICOLOR_FORCE env var, which dates back to at least 2000 with FreeBSD 4.1.1 and which is supported by tools like CMake. <https://bixense.com/clicolors/>
2024-05-27Progress: fix compile errors on windowsJacob Young
Works for `zig build-exe`, IPC still not implemented yet.
2024-05-10define an error set for `std.io.tty.Config.setColor`Veikka Tuominen
2024-05-03add std.zip and support zip files in build.zig.zonJonathan Marler
fixes #17408 Helpful reviewers/testers include Joshe Wolfe, Auguste Rame, Andrew Kelley and Jacob Young. Co-authored-by: Joel Gustafson <joelg@mit.edu>