aboutsummaryrefslogtreecommitdiff
path: root/lib/std/std.zig
AgeCommit message (Collapse)Author
2023-07-21std.json: Unify stringify and writeStream (#16405)Josh Wolfe
2023-03-17add BoundedArrayAligned (#14580)Motiejus Jakštys
This is useful for creating byte buffers of actually-different-things. Copied the argument order from `Allocator.alignedAlloc` I noted that `ArrayListAligned` is going out of it's way to not set the alignment at comptime when it is not specified. However, I was not able to do that the same way here, and good people on IRC, @ifreund in particular (thanks!) assured me that [N]T align(@alignOf(T)) is equivalent to [N]T
2023-03-14Move std.crypto.config options to std.options (#14906)Frank Denis
Options have been moved to a single namespace.
2023-03-09std.http: rework connection pool into its own typeNameless
2023-03-03std.process.Child: remove pid and handle, add idAndrew Kelley
Previously, this API had pid, to be used on POSIX systems, and handle, to be used on Windows. This commit unifies the API, defining an Id type that is either the pid or the HANDLE depending on the target OS. This commit also prepares for the future by allowing one to import via `std.process.Child` which is the fully qualified namespace that I intend to migrate to in the future.
2023-02-21std.RingBuffer: add (non-concurrent) RingBuffer implementationdweiller
2023-02-18use std_options for keep_sigpipe and existence of SIG.PIPE to check for supportJonathan Marler
2023-02-01fmt: Make default_max_depth configurableominitay
2023-01-31std.Build: add deprecated declarationsAndrew Kelley
These declarations are now aliases of their new APIs and marked as deprecated via doc comments: * std.build.Builder * std.build * std.Build.LibExeObjStep
2023-01-31rename std.Build.LibExeObjStep to std.Build.CompileStepAndrew Kelley
This matches the nomenclature internally: a Compilation is the main type that represents a single invokation of the compiler.
2023-01-31combine std.build and std.build.Builder into std.BuildAndrew Kelley
I've been wanting to do this for along time.
2023-01-11add std.tar for tar file unpackingAndrew Kelley
2023-01-06Renames Url.zig to Uri.zigFelix "xq" Queißner
2023-01-05std: collect all options under one namespaceVeikka Tuominen
2023-01-02add url parsing to the std libAndrew Kelley
2023-01-02remove the experimental std.x namespaceAndrew Kelley
Playtime is over. I'm working on networking now.
2022-12-18Make std.tz namespace accessibleEvin Yulo
Closes #13978
2022-12-11std.build: extract steps to separate filesAndrew Kelley
There are intended to be no functional changes in this commit.
2022-05-11std: add http definitions for Method and Status (#10661)Meghan
2022-04-20std: bring back SegmentedListAndrew Kelley
I want to use it for the self-hosted compiler.
2022-04-15treap: initial implementationkprotty
2022-03-27std: SIMD utility functionstecanec
This file contains a collections of functions that may be useful for SIMD, such as generating a vector with a linear range of numbers starting at zero, joining two vectors together, getting the index of the first true in a vector of bools, etc.
2021-12-31tz parsing reader interface, test thicc files, and exclude tzifJens Goldberg
2021-12-30Actually expose the tz fileJens Goldberg
2021-10-04migrate from `std.Target.current` to `@import("builtin").target`Andrew Kelley
closes #9388 closes #9321
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-08-24BoundedArray: a simple way to represent small data whose max size is known ↵Frank Denis
(#9134) This is a simple structure containing an array and a length, that can be viewed as a slice. It is useful to pass-by-copy small data whose exact size is known at runtime, but whose maximum size is known at comptime. This greatly simplifies code that otherwise would require an allocator, or reimplementing what this type does.
2021-04-25x, x/os/Socket: initial work on new Socket abstractionlithdew
Kick-start initial work on new cross-platform abstraction for sockets. Adds a test for read timeouts and a test for creating a non-blocking socket pair on Linux. The new Socket abstraction is barebones and is made to support both blocking and non-blocking abstractions, alongside different socket protocols and domains. Support for platform-dependant socket options that handles unsupported platforms gracefully via. comptime checks is provided for the new Socket abstraction. This also marks the first out of many commits for introducing breaking changes to the standard library in a separate `x` folder, which was pre-approved by @andrewrk. The intent for the new `x` package is to introduce new async, event loop, networking, and operating system abstractions that would require breaking the standard library significantly. By having the `x` package, code in the standard library and compiler may then slowly be refactored to use the `x` package. Once modules in the `x` package are stabilized, they can be moved out of the `x` package, and a global 'grep' can be done to update import paths that resolve to the stabilized module in the `x` package.
2021-04-08stage2: blaze the trail for std lib integrationAndrew Kelley
This branch adds "builtin" and "std" to the import table when using the self-hosted backend. "builtin" gains one additional item: ``` pub const zig_is_stage2 = true; // false when using stage1 backend ``` This allows the std lib to do conditional compilation based on detecting which backend is being used. This will be removed from builtin as soon as self-hosted catches up to feature parity with stage1. Keep a sharp eye out - people are going to be tempted to abuse this. The general rule of thumb is do not use `builtin.zig_is_stage2`. However this commit breaks the rule so that we can gain limited start.zig support as we incrementally improve the self-hosted compiler. This commit also implements `fullyQualifiedNameHash` and related functionality, which effectively puts all Decls in their proper namespaces. `fullyQualifiedName` is not yet implemented. Stop printing "todo" log messages for test decls unless we are in test mode. Add "previous definition here" error notes for Decl name collisions. This commit does not bring us yet to a newly passing test case. Here's what I'm working towards: ```zig const std = @import("std"); export fn main() c_int { const a = std.fs.base64_alphabet[0]; return a - 'A'; } ``` Current output: ``` $ ./zig-cache/bin/zig build-exe test.zig test.zig:3:1: error: TODO implement more analyze elemptr zig-cache/lib/zig/std/start.zig:38:46: error: TODO implement structInitExpr ty ``` So the next steps are clear: * Sema: improve elemptr * AstGen: implement structInitExpr
2021-04-02Merge pull request #7792 from zanderxyz/zanderxyz/priority-dequeueAndrew Kelley
std: Add Priority Dequeue
2021-03-18Add some enum utilitiesMartin Wickham
2021-03-01Add some bit set variantsMartin Wickham
2021-02-11Merge remote-tracking branch 'origin/master' into ast-memory-layoutAndrew Kelley
Conflicts: * lib/std/zig/ast.zig * lib/std/zig/parse.zig * lib/std/zig/parser_test.zig * lib/std/zig/render.zig * src/Module.zig * src/zir.zig I resolved some of the conflicts by reverting a small portion of @tadeokondrak's stage2 logic here regarding `callconv(.Inline)`. It will need to get reworked as part of this branch.
2021-02-01Define wasm constantsLuuk de Gram
Update link.Wasm.zig to use std.wasm for its constants Make opcodes u8 and non-exhaustive Update test and rename 'spec' to 'wasm'
2021-01-30add std.MultiArrayListAndrew Kelley
Also known as "Struct-Of-Arrays" or "SOA". The purpose of this data structure is to provide a similar API to ArrayList but instead of the element type being a struct, the fields of the struct are in N different arrays, all with the same length and capacity. Having this abstraction means we can put them in the same allocation, avoiding overhead with the allocator. It also saves a tiny bit of overhead from the redundant capacity and length fields, since each struct element shares the same value. This is an alternate implementation to #7854.
2021-01-22std: Update `test ""` to `test` where it makes senseLemonBoy
2021-01-16std: Add Priority DequeueZander Khan
2021-01-14organize std lib concurrency primitives and add RwLockAndrew Kelley
* move concurrency primitives that always operate on kernel threads to the std.Thread namespace * remove std.SpinLock. Nobody should use this in a non-freestanding environment; the other primitives are always preferable. In freestanding, it will be necessary to put custom spin logic in there, so there are no use cases for a std lib version. * move some std lib files to the top level fields convention * add std.Thread.spinLoopHint * add std.Thread.Condition * add std.Thread.Semaphore * new implementation of std.Thread.Mutex for Windows and non-pthreads Linux * add std.Thread.RwLock Implementations provided by @kprotty
2021-01-06std.SpinLock: flatten and remove init/deinitAndrew Kelley
structs which are intended to be directly initialized and support static initialization should not have init/deinit methods.
2021-01-04std: skip more tests on Windows to save CI memoryAndrew Kelley
I've enabled only the tests that check things specific to Windows that are not tested by other systems.
2020-12-31Year++Frank Denis
2020-12-24Merge pull request #7531 from Vexu/orphanageVeikka Tuominen
Move ArrayListSentineled to std lib orphanage
2020-12-23rework std.ResetEvent, improve std lib Darwin integrationAndrew Kelley
* split std.ResetEvent into: - ResetEvent - requires init() at runtime and it can fail. Also requires deinit(). - StaticResetEvent - can be statically initialized and requires no deinitialization. Initialization cannot fail. * the POSIX sem_t implementation can in fact fail on initialization because it is allowed to be implemented as a file descriptor. * Completely define, clarify, and explain in detail the semantics of these APIs. Remove the `isSet` function. * `ResetEvent.timedWait` returns an enum instead of a possible error. * `ResetEvent.init` takes a pointer to the ResetEvent instead of returning a copy. * On Darwin, `ResetEvent` is implemented using Grand Central Dispatch, which is exposed by libSystem. stage2 changes: * ThreadPool: use a single, pre-initialized `ResetEvent` per worker. * WaitGroup: now requires init() and deinit() and init() can fail. - Add a `reset` function. - Compilation initializes one for the work queue in creation and re-uses it for every update. - Rename `stop` to `finish`. - Simplify the implementation based on the usage pattern.
2020-12-23move ArrayListSentineled to std lib orphanageVeikka Tuominen
2020-12-20std.Progress: make the API thread-safeAndrew Kelley
We generally get away with atomic primitives, however a lock is required around the refresh function since it traverses the Node graph, and we need to be sure no references to Nodes remain after end() is called.
2020-11-30move std.SegmentedList to the std-lib-orphanageAndrew Kelley
I spent a long time working on this data structure, and I still think it's a neat idea, but it has no business being in the std lib. I'm aware of the few remaining references to SegmentedList that exist in the std lib, but they are dead code, and so I'm leaving the dead references as a clue that the code is dead. Cleaning up dead code will be a separate effort that involves code coverage tools to make sure we find it all. std-lib-orphanage commit: 2c36a7894c689ecbaf63d5f489bb0c68773410c4 closes #7190
2020-11-16Move leb128 and remove trivial *mem functions as discussed in #5588 (#6876)tgschultz
* Move leb128 out of debug and remove trivial *mem functions as discussed in #5588 * Turns out one of the *Mem functions was used by MachO. Replaced with trivial use of FixedBufferStream.
2020-11-06std: Introduce SemanticVersion data structureJay Petacat
This will parse, format, and compare version strings following the SemVer 2 specification. See: https://semver.org Updates #6466
2020-10-15std: move std.meta.refAllDecls to std.testingTadeo Kondrak
2020-10-11AutoResetEventkprotty