Fix simple doc mistakes. (#17624)

* Add missing period in Stack's description

This looks fine in the source, but looks bad when seen on the documentation website.

* Correct documentation for attachSegfaultHandler()

The description for attachSegfaultHandler() looks pretty bad without indicating that the stuff at the end is code

* Added missing 'the's in Queue.put's documentation

* Fixed several errors in Stack's documentation

`push()` and `pop()` were not styled as code

There was no period after `pop()`, which looks bad on the documentation.

* Fix multiple problems in base64.zig

Both "invalid"s in Base64.decoder were not capitalized.

Missing period in documentation of Base64DecoderWithIgnore.calcSizeUpperBound.

* Fix capitalization typos in bit_set.zig

In DynamicBitSetUnmanaged.deinit's and DynamicBitSet.deinit's documentation, "deinitializes" was uncapitalized.

* Fix typos in fifo.zig's documentation

Added a previously missing period to the end of the first line of LinearFifo.writableSlice's documentation.
Added missing periods to both lines of LinearFifo.pump's documentation.

* Fix typos in fmt.bufPrint's documentation

The starts of both lines were not capitalized.

* Fix minor documentation problems in fs/file.zig

Missing periods in documentation for Permissions.setReadOnly, PermissionsWindows.setReadOnly, MetadataUnix.created, MetadataLinux.created, and MetadataWindows.created.

* Fix a glaring typo in enums.zig

* Correct errors in fs.zig

* Fixed documentation problems in hash_map.zig

The added empty line in verify_context's documentation is needed, otherwise autodoc for some reason assumes that the list hasn't been terminated and continues reading off the rest of the documentation as if it were part of the second list item.

* Added lines between consecutive URLs in http.zig

Makes the documentation conform closer to what was intended.

* Fix wrongfully ended sentence in Uri.zig

* Handle wrongly entered comma in valgrind.zig.

* Add missing periods in wasm.zig's documentation

* Fix odd spacing in event/loop.zig

* Add missing period in http/Headers.zig

* Added missing period in io/limited_reader.zig

This isn't in the documentation due to what I guess is a limitation of autodoc, but it's clearly supposed to be. If it was, it would look pretty bad.

* Correct documentation in math/big/int.zig

* Correct formatting in math/big/rational.zig

* Create an actual link to ZIGNOR's paper.

* Fixed grammatical issues in sort/block.zig

This will not show up in the documentation currently.

* Fix typo in hash_map.zig
This commit is contained in:
JustinWayland 2023-10-21 17:24:55 -04:00 committed by GitHub
parent 3f4df85299
commit c45af2af61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 57 additions and 48 deletions

View file

@ -129,7 +129,7 @@ pub fn unescapeString(allocator: std.mem.Allocator, input: []const u8) error{Out
pub const ParseError = error{ UnexpectedCharacter, InvalidFormat, InvalidPort }; pub const ParseError = error{ UnexpectedCharacter, InvalidFormat, InvalidPort };
/// Parses the URI or returns an error. This function is not compliant, but is required to parse /// Parses the URI or returns an error. This function is not compliant, but is required to parse
/// some forms of URIs in the wild. Such as HTTP Location headers. /// some forms of URIs in the wild, such as HTTP Location headers.
/// The return value will contain unescaped strings pointing into the /// The return value will contain unescaped strings pointing into the
/// original `text`. Each component that is provided, will be non-`null`. /// original `text`. Each component that is provided, will be non-`null`.
pub fn parseWithoutScheme(text: []const u8) ParseError!Uri { pub fn parseWithoutScheme(text: []const u8) ParseError!Uri {

View file

@ -27,7 +27,7 @@ pub fn Queue(comptime T: type) type {
} }
/// Appends `node` to the queue. /// Appends `node` to the queue.
/// The lifetime of `node` must be longer than lifetime of queue. /// The lifetime of `node` must be longer than the lifetime of the queue.
pub fn put(self: *Self, node: *Node) void { pub fn put(self: *Self, node: *Node) void {
node.next = null; node.next = null;

View file

@ -3,8 +3,8 @@ const builtin = @import("builtin");
const assert = std.debug.assert; const assert = std.debug.assert;
const expect = std.testing.expect; const expect = std.testing.expect;
/// Many reader, many writer, non-allocating, thread-safe /// Many reader, many writer, non-allocating, thread-safe.
/// Uses a spinlock to protect push() and pop() /// Uses a spinlock to protect `push()` and `pop()`.
/// When building in single threaded mode, this is a simple linked list. /// When building in single threaded mode, this is a simple linked list.
pub fn Stack(comptime T: type) type { pub fn Stack(comptime T: type) type {
return struct { return struct {

View file

@ -203,8 +203,8 @@ pub const Base64Decoder = struct {
} }
/// dest.len must be what you get from ::calcSize. /// dest.len must be what you get from ::calcSize.
/// invalid characters result in error.InvalidCharacter. /// Invalid characters result in `error.InvalidCharacter`.
/// invalid padding results in error.InvalidPadding. /// Invalid padding results in `error.InvalidPadding`.
pub fn decode(decoder: *const Base64Decoder, dest: []u8, source: []const u8) Error!void { pub fn decode(decoder: *const Base64Decoder, dest: []u8, source: []const u8) Error!void {
if (decoder.pad_char != null and source.len % 4 != 0) return error.InvalidPadding; if (decoder.pad_char != null and source.len % 4 != 0) return error.InvalidPadding;
var dest_idx: usize = 0; var dest_idx: usize = 0;
@ -291,7 +291,7 @@ pub const Base64DecoderWithIgnore = struct {
return result; return result;
} }
/// Return the maximum possible decoded size for a given input length - The actual length may be less if the input includes padding /// Return the maximum possible decoded size for a given input length - The actual length may be less if the input includes padding.
/// `InvalidPadding` is returned if the input length is not valid. /// `InvalidPadding` is returned if the input length is not valid.
pub fn calcSizeUpperBound(decoder_with_ignore: *const Base64DecoderWithIgnore, source_len: usize) Error!usize { pub fn calcSizeUpperBound(decoder_with_ignore: *const Base64DecoderWithIgnore, source_len: usize) Error!usize {
var result = source_len / 4 * 3; var result = source_len / 4 * 3;

View file

@ -753,7 +753,7 @@ pub const DynamicBitSetUnmanaged = struct {
self.bit_length = new_len; self.bit_length = new_len;
} }
/// deinitializes the array and releases its memory. /// Deinitializes the array and releases its memory.
/// The passed allocator must be the same one used for /// The passed allocator must be the same one used for
/// init* or resize in the past. /// init* or resize in the past.
pub fn deinit(self: *Self, allocator: Allocator) void { pub fn deinit(self: *Self, allocator: Allocator) void {
@ -1058,7 +1058,7 @@ pub const DynamicBitSet = struct {
try self.unmanaged.resize(self.allocator, new_len, fill); try self.unmanaged.resize(self.allocator, new_len, fill);
} }
/// deinitializes the array and releases its memory. /// Deinitializes the array and releases its memory.
/// The passed allocator must be the same one used for /// The passed allocator must be the same one used for
/// init* or resize in the past. /// init* or resize in the past.
pub fn deinit(self: *Self) void { pub fn deinit(self: *Self) void {

View file

@ -2340,7 +2340,7 @@ pub fn updateSegfaultHandler(act: ?*const os.Sigaction) error{OperationNotSuppor
try os.sigaction(os.SIG.FPE, act, null); try os.sigaction(os.SIG.FPE, act, null);
} }
/// Attaches a global SIGSEGV handler which calls @panic("segmentation fault"); /// Attaches a global SIGSEGV handler which calls `@panic("segmentation fault");`
pub fn attachSegfaultHandler() void { pub fn attachSegfaultHandler() void {
if (!have_segfault_handling_support) { if (!have_segfault_handling_support) {
@compileError("segfault handler not supported for this target"); @compileError("segfault handler not supported for this target");

View file

@ -425,7 +425,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
} }
} }
/// Deccreases the all key counts by given multiset. If /// Decreases the all key counts by given multiset. If
/// the given multiset has more key counts than this, /// the given multiset has more key counts than this,
/// then that key will have a key count of zero. /// then that key will have a key count of zero.
pub fn removeSet(self: *Self, other: Self) void { pub fn removeSet(self: *Self, other: Self) void {

View file

@ -969,21 +969,21 @@ pub const Loop = struct {
/// This argument is a socket that has been created with `socket`, bound to a local address /// This argument is a socket that has been created with `socket`, bound to a local address
/// with `bind`, and is listening for connections after a `listen`. /// with `bind`, and is listening for connections after a `listen`.
sockfd: os.socket_t, sockfd: os.socket_t,
/// This argument is a pointer to a sockaddr structure. This structure is filled in with the /// This argument is a pointer to a sockaddr structure. This structure is filled in with the
/// address of the peer socket, as known to the communications layer. The exact format of the /// address of the peer socket, as known to the communications layer. The exact format of the
/// address returned addr is determined by the socket's address family (see `socket` and the /// address returned addr is determined by the socket's address family (see `socket` and the
/// respective protocol man pages). /// respective protocol man pages).
addr: *os.sockaddr, addr: *os.sockaddr,
/// This argument is a value-result argument: the caller must initialize it to contain the /// This argument is a value-result argument: the caller must initialize it to contain the
/// size (in bytes) of the structure pointed to by addr; on return it will contain the actual size /// size (in bytes) of the structure pointed to by addr; on return it will contain the actual size
/// of the peer address. /// of the peer address.
/// ///
/// The returned address is truncated if the buffer provided is too small; in this case, `addr_size` /// The returned address is truncated if the buffer provided is too small; in this case, `addr_size`
/// will return a value greater than was supplied to the call. /// will return a value greater than was supplied to the call.
addr_size: *os.socklen_t, addr_size: *os.socklen_t,
/// The following values can be bitwise ORed in flags to obtain different behavior: /// The following values can be bitwise ORed in flags to obtain different behavior:
/// * `SOCK.CLOEXEC` - Set the close-on-exec (`FD_CLOEXEC`) flag on the new file descriptor. See the /// * `SOCK.CLOEXEC` - Set the close-on-exec (`FD_CLOEXEC`) flag on the new file descriptor. See the
/// description of the `O.CLOEXEC` flag in `open` for reasons why this may be useful. /// description of the `O.CLOEXEC` flag in `open` for reasons why this may be useful.
flags: u32, flags: u32,
) os.AcceptError!os.socket_t { ) os.AcceptError!os.socket_t {
while (true) { while (true) {

View file

@ -242,7 +242,7 @@ pub fn LinearFifo(
return self.buf.len - self.count; return self.buf.len - self.count;
} }
/// Returns the first section of writable buffer /// Returns the first section of writable buffer.
/// Note that this may be of length 0 /// Note that this may be of length 0
pub fn writableSlice(self: SliceSelfArg, offset: usize) []T { pub fn writableSlice(self: SliceSelfArg, offset: usize) []T {
if (offset > self.buf.len) return &[_]T{}; if (offset > self.buf.len) return &[_]T{};
@ -371,8 +371,8 @@ pub fn LinearFifo(
return self.buf[index]; return self.buf[index];
} }
/// Pump data from a reader into a writer /// Pump data from a reader into a writer.
/// stops when reader returns 0 bytes (EOF) /// Stops when reader returns 0 bytes (EOF).
/// Buffer size must be set before calling; a buffer length of 0 is invalid. /// Buffer size must be set before calling; a buffer length of 0 is invalid.
pub fn pump(self: *Self, src_reader: anytype, dest_writer: anytype) !void { pub fn pump(self: *Self, src_reader: anytype, dest_writer: anytype) !void {
assert(self.buf.len > 0); assert(self.buf.len > 0);

View file

@ -1989,8 +1989,8 @@ pub const BufPrintError = error{
NoSpaceLeft, NoSpaceLeft,
}; };
/// print a Formatter string into `buf`. Actually just a thin wrapper around `format` and `fixedBufferStream`. /// Print a Formatter string into `buf`. Actually just a thin wrapper around `format` and `fixedBufferStream`.
/// returns a slice of the bytes printed to. /// Returns a slice of the bytes printed to.
pub fn bufPrint(buf: []u8, comptime fmt: []const u8, args: anytype) BufPrintError![]u8 { pub fn bufPrint(buf: []u8, comptime fmt: []const u8, args: anytype) BufPrintError![]u8 {
var fbs = std.io.fixedBufferStream(buf); var fbs = std.io.fixedBufferStream(buf);
try format(fbs.writer(), fmt, args); try format(fbs.writer(), fmt, args);

View file

@ -204,7 +204,7 @@ pub const AtomicFile = struct {
} }
} }
/// always call deinit, even after successful finish() /// Always call deinit, even after a successful finish().
pub fn deinit(self: *AtomicFile) void { pub fn deinit(self: *AtomicFile) void {
if (self.file_open) { if (self.file_open) {
self.file.close(); self.file.close();

View file

@ -453,7 +453,7 @@ pub const File = struct {
} }
/// Sets whether write permissions are provided. /// Sets whether write permissions are provided.
/// On Unix, this affects *all* classes. If this is undesired, use `unixSet` /// On Unix, this affects *all* classes. If this is undesired, use `unixSet`.
/// This method *DOES NOT* set permissions on the filesystem: use `File.setPermissions(permissions)` /// This method *DOES NOT* set permissions on the filesystem: use `File.setPermissions(permissions)`
pub fn setReadOnly(self: *Self, read_only: bool) void { pub fn setReadOnly(self: *Self, read_only: bool) void {
self.inner.setReadOnly(read_only); self.inner.setReadOnly(read_only);
@ -493,7 +493,7 @@ pub const File = struct {
} }
/// Sets whether write permissions are provided. /// Sets whether write permissions are provided.
/// This affects *all* classes. If this is undesired, use `unixSet` /// This affects *all* classes. If this is undesired, use `unixSet`.
/// This method *DOES NOT* set permissions on the filesystem: use `File.setPermissions(permissions)` /// This method *DOES NOT* set permissions on the filesystem: use `File.setPermissions(permissions)`
pub fn setReadOnly(self: *Self, read_only: bool) void { pub fn setReadOnly(self: *Self, read_only: bool) void {
if (read_only) { if (read_only) {
@ -706,7 +706,7 @@ pub const File = struct {
return @as(i128, mtime.tv_sec) * std.time.ns_per_s + mtime.tv_nsec; return @as(i128, mtime.tv_sec) * std.time.ns_per_s + mtime.tv_nsec;
} }
/// Returns the time the file was created in nanoseconds since UTC 1970-01-01 /// Returns the time the file was created in nanoseconds since UTC 1970-01-01.
/// Returns null if this is not supported by the OS or filesystem /// Returns null if this is not supported by the OS or filesystem
pub fn created(self: Self) ?i128 { pub fn created(self: Self) ?i128 {
if (!@hasDecl(@TypeOf(self.stat), "birthtime")) return null; if (!@hasDecl(@TypeOf(self.stat), "birthtime")) return null;
@ -772,7 +772,7 @@ pub const File = struct {
return @as(i128, self.statx.mtime.tv_sec) * std.time.ns_per_s + self.statx.mtime.tv_nsec; return @as(i128, self.statx.mtime.tv_sec) * std.time.ns_per_s + self.statx.mtime.tv_nsec;
} }
/// Returns the time the file was created in nanoseconds since UTC 1970-01-01 /// Returns the time the file was created in nanoseconds since UTC 1970-01-01.
/// Returns null if this is not supported by the filesystem, or on kernels before than version 4.11 /// Returns null if this is not supported by the filesystem, or on kernels before than version 4.11
pub fn created(self: Self) ?i128 { pub fn created(self: Self) ?i128 {
if (self.statx.mask & os.linux.STATX_BTIME == 0) return null; if (self.statx.mask & os.linux.STATX_BTIME == 0) return null;
@ -825,7 +825,7 @@ pub const File = struct {
return self.modified_time; return self.modified_time;
} }
/// Returns the time the file was created in nanoseconds since UTC 1970-01-01 /// Returns the time the file was created in nanoseconds since UTC 1970-01-01.
/// This never returns null, only returning an optional for compatibility with other OSes /// This never returns null, only returning an optional for compatibility with other OSes
pub fn created(self: Self) ?i128 { pub fn created(self: Self) ?i128 {
return self.creation_time; return self.creation_time;

View file

@ -126,6 +126,7 @@ pub const default_max_load_percentage = 80;
/// member functions: /// member functions:
/// - hash(self, PseudoKey) Hash /// - hash(self, PseudoKey) Hash
/// - eql(self, PseudoKey, Key) bool /// - eql(self, PseudoKey, Key) bool
///
/// If you are passing a context to a *Adapted function, PseudoKey is the type /// If you are passing a context to a *Adapted function, PseudoKey is the type
/// of the key parameter. Otherwise, when creating a HashMap or HashMapUnmanaged /// of the key parameter. Otherwise, when creating a HashMap or HashMapUnmanaged
/// type, PseudoKey = Key = K. /// type, PseudoKey = Key = K.
@ -469,7 +470,7 @@ pub fn HashMap(
} }
/// If key exists this function cannot fail. /// If key exists this function cannot fail.
/// If there is an existing item with `key`, then the result /// If there is an existing item with `key`, then the result's
/// `Entry` pointers point to it, and found_existing is true. /// `Entry` pointers point to it, and found_existing is true.
/// Otherwise, puts a new item with undefined value, and /// Otherwise, puts a new item with undefined value, and
/// the `Entry` pointers point to it. Caller should then initialize /// the `Entry` pointers point to it. Caller should then initialize
@ -479,7 +480,7 @@ pub fn HashMap(
} }
/// If key exists this function cannot fail. /// If key exists this function cannot fail.
/// If there is an existing item with `key`, then the result /// If there is an existing item with `key`, then the result's
/// `Entry` pointers point to it, and found_existing is true. /// `Entry` pointers point to it, and found_existing is true.
/// Otherwise, puts a new item with undefined key and value, and /// Otherwise, puts a new item with undefined key and value, and
/// the `Entry` pointers point to it. Caller must then initialize /// the `Entry` pointers point to it. Caller must then initialize
@ -488,7 +489,7 @@ pub fn HashMap(
return self.unmanaged.getOrPutContextAdapted(self.allocator, key, ctx, self.ctx); return self.unmanaged.getOrPutContextAdapted(self.allocator, key, ctx, self.ctx);
} }
/// If there is an existing item with `key`, then the result /// If there is an existing item with `key`, then the result's
/// `Entry` pointers point to it, and found_existing is true. /// `Entry` pointers point to it, and found_existing is true.
/// Otherwise, puts a new item with undefined value, and /// Otherwise, puts a new item with undefined value, and
/// the `Entry` pointers point to it. Caller should then initialize /// the `Entry` pointers point to it. Caller should then initialize
@ -499,7 +500,7 @@ pub fn HashMap(
return self.unmanaged.getOrPutAssumeCapacityContext(key, self.ctx); return self.unmanaged.getOrPutAssumeCapacityContext(key, self.ctx);
} }
/// If there is an existing item with `key`, then the result /// If there is an existing item with `key`, then the result's
/// `Entry` pointers point to it, and found_existing is true. /// `Entry` pointers point to it, and found_existing is true.
/// Otherwise, puts a new item with undefined value, and /// Otherwise, puts a new item with undefined value, and
/// the `Entry` pointers point to it. Caller must then initialize /// the `Entry` pointers point to it. Caller must then initialize
@ -565,7 +566,7 @@ pub fn HashMap(
} }
/// Inserts a new `Entry` into the hash map, returning the previous one, if any. /// Inserts a new `Entry` into the hash map, returning the previous one, if any.
/// If insertion happuns, asserts there is enough capacity without allocating. /// If insertion happens, asserts there is enough capacity without allocating.
pub fn fetchPutAssumeCapacity(self: *Self, key: K, value: V) ?KV { pub fn fetchPutAssumeCapacity(self: *Self, key: K, value: V) ?KV {
return self.unmanaged.fetchPutAssumeCapacityContext(key, value, self.ctx); return self.unmanaged.fetchPutAssumeCapacityContext(key, value, self.ctx);
} }
@ -684,7 +685,7 @@ pub fn HashMap(
} }
/// A HashMap based on open addressing and linear probing. /// A HashMap based on open addressing and linear probing.
/// A lookup or modification typically occurs only 2 cache misses. /// A lookup or modification typically incurs only 2 cache misses.
/// No order is guaranteed and any modification invalidates live iterators. /// No order is guaranteed and any modification invalidates live iterators.
/// It achieves good performance with quite high load factors (by default, /// It achieves good performance with quite high load factors (by default,
/// grow is triggered at 80% full) and only one byte of overhead per element. /// grow is triggered at 80% full) and only one byte of overhead per element.

View file

@ -14,7 +14,9 @@ pub const Version = enum {
}; };
/// https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods /// https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
///
/// https://datatracker.ietf.org/doc/html/rfc7231#section-4 Initial definition /// https://datatracker.ietf.org/doc/html/rfc7231#section-4 Initial definition
///
/// https://datatracker.ietf.org/doc/html/rfc5789#section-2 PATCH /// https://datatracker.ietf.org/doc/html/rfc5789#section-2 PATCH
pub const Method = enum(u64) { // TODO: should be u192 or u256, but neither is supported by the C backend, and therefore cannot pass CI pub const Method = enum(u64) { // TODO: should be u192 or u256, but neither is supported by the C backend, and therefore cannot pass CI
GET = parse("GET"), GET = parse("GET"),
@ -68,7 +70,9 @@ pub const Method = enum(u64) { // TODO: should be u192 or u256, but neither is s
} }
/// An HTTP method is safe if it doesn't alter the state of the server. /// An HTTP method is safe if it doesn't alter the state of the server.
///
/// https://developer.mozilla.org/en-US/docs/Glossary/Safe/HTTP /// https://developer.mozilla.org/en-US/docs/Glossary/Safe/HTTP
///
/// https://datatracker.ietf.org/doc/html/rfc7231#section-4.2.1 /// https://datatracker.ietf.org/doc/html/rfc7231#section-4.2.1
pub fn safe(self: Method) bool { pub fn safe(self: Method) bool {
return switch (self) { return switch (self) {
@ -79,7 +83,9 @@ pub const Method = enum(u64) { // TODO: should be u192 or u256, but neither is s
} }
/// An HTTP method is idempotent if an identical request can be made once or several times in a row with the same effect while leaving the server in the same state. /// An HTTP method is idempotent if an identical request can be made once or several times in a row with the same effect while leaving the server in the same state.
///
/// https://developer.mozilla.org/en-US/docs/Glossary/Idempotent /// https://developer.mozilla.org/en-US/docs/Glossary/Idempotent
///
/// https://datatracker.ietf.org/doc/html/rfc7231#section-4.2.2 /// https://datatracker.ietf.org/doc/html/rfc7231#section-4.2.2
pub fn idempotent(self: Method) bool { pub fn idempotent(self: Method) bool {
return switch (self) { return switch (self) {
@ -90,7 +96,9 @@ pub const Method = enum(u64) { // TODO: should be u192 or u256, but neither is s
} }
/// A cacheable response is an HTTP response that can be cached, that is stored to be retrieved and used later, saving a new request to the server. /// A cacheable response is an HTTP response that can be cached, that is stored to be retrieved and used later, saving a new request to the server.
///
/// https://developer.mozilla.org/en-US/docs/Glossary/cacheable /// https://developer.mozilla.org/en-US/docs/Glossary/cacheable
///
/// https://datatracker.ietf.org/doc/html/rfc7231#section-4.2.3 /// https://datatracker.ietf.org/doc/html/rfc7231#section-4.2.3
pub fn cacheable(self: Method) bool { pub fn cacheable(self: Method) bool {
return switch (self) { return switch (self) {

View file

@ -249,7 +249,7 @@ pub const Headers = struct {
try out_stream.writeAll("\r\n"); try out_stream.writeAll("\r\n");
} }
/// Frees all `HeaderIndexList`s within `index` /// Frees all `HeaderIndexList`s within `index`.
/// Frees names and values of all fields if they are owned. /// Frees names and values of all fields if they are owned.
fn deallocateIndexListsAndFields(headers: *Headers) void { fn deallocateIndexListsAndFields(headers: *Headers) void {
var it = headers.index.iterator(); var it = headers.index.iterator();

View file

@ -26,7 +26,7 @@ pub fn LimitedReader(comptime ReaderType: type) type {
}; };
} }
/// Returns an initialised `LimitedReader` /// Returns an initialised `LimitedReader`.
/// `bytes_left` is a `u64` to be able to take 64 bit file offsets /// `bytes_left` is a `u64` to be able to take 64 bit file offsets
pub fn limitedReader(inner_reader: anytype, bytes_left: u64) LimitedReader(@TypeOf(inner_reader)) { pub fn limitedReader(inner_reader: anytype, bytes_left: u64) LimitedReader(@TypeOf(inner_reader)) {
return .{ .inner_reader = inner_reader, .bytes_left = bytes_left }; return .{ .inner_reader = inner_reader, .bytes_left = bytes_left };

View file

@ -452,6 +452,7 @@ pub const Mutable = struct {
} }
/// r = a + b /// r = a + b
///
/// r, a and b may be aliases. /// r, a and b may be aliases.
/// ///
/// Asserts the result fits in `r`. An upper bound on the number of limbs needed by /// Asserts the result fits in `r`. An upper bound on the number of limbs needed by
@ -1869,7 +1870,7 @@ pub const Mutable = struct {
} }
} }
/// Read the value of `x` from `buffer` /// Read the value of `x` from `buffer`.
/// Asserts that `buffer` is large enough to contain a value of bit-size `bit_count`. /// Asserts that `buffer` is large enough to contain a value of bit-size `bit_count`.
/// ///
/// The contents of `buffer` are interpreted as if they were the contents of /// The contents of `buffer` are interpreted as if they were the contents of

View file

@ -333,8 +333,8 @@ pub const Rational = struct {
r.q.swap(&other.q); r.q.swap(&other.q);
} }
/// Returns math.Order.lt, math.Order.eq, math.Order.gt if a < b, a == b or a /// Returns math.Order.lt, math.Order.eq, math.Order.gt if a < b, a == b or
/// > b respectively. /// a > b respectively.
pub fn order(a: Rational, b: Rational) !math.Order { pub fn order(a: Rational, b: Rational) !math.Order {
return cmpInternal(a, b, false); return cmpInternal(a, b, false);
} }

View file

@ -1,7 +1,6 @@
//! Implements ZIGNOR [1]. //! Implements [ZIGNOR][1] (Jurgen A. Doornik, 2005, Nuffield College, Oxford).
//! //!
//! [1]: Jurgen A. Doornik (2005). [*An Improved Ziggurat Method to Generate Normal Random Samples*] //! [1]: https://www.doornik.com/research/ziggurat.pdf
//! (https://www.doornik.com/research/ziggurat.pdf). Nuffield College, Oxford.
//! //!
//! rust/rand used as a reference; //! rust/rand used as a reference;
//! //!

View file

@ -95,7 +95,7 @@ const Pull = struct {
/// O(1) memory (no allocator required). /// O(1) memory (no allocator required).
/// Sorts in ascending order with respect to the given `lessThan` function. /// Sorts in ascending order with respect to the given `lessThan` function.
/// ///
/// NOTE: the algorithm only work when the comparison is less-than or greater-than /// NOTE: The algorithm only works when the comparison is less-than or greater-than.
/// (See https://github.com/ziglang/zig/issues/8289) /// (See https://github.com/ziglang/zig/issues/8289)
pub fn block( pub fn block(
comptime T: type, comptime T: type,

View file

@ -250,7 +250,7 @@ pub fn disableErrorReporting() void {
doClientRequestStmt(.ChangeErrDisablement, 1, 0, 0, 0, 0); doClientRequestStmt(.ChangeErrDisablement, 1, 0, 0, 0, 0);
} }
/// Re-enable error reporting, (see disableErrorReporting()) /// Re-enable error reporting. (see disableErrorReporting())
pub fn enableErrorReporting() void { pub fn enableErrorReporting() void {
doClientRequestStmt(.ChangeErrDisablement, math.maxInt(usize), 0, 0, 0, 0); doClientRequestStmt(.ChangeErrDisablement, math.maxInt(usize), 0, 0, 0, 0);
} }

View file

@ -216,7 +216,7 @@ test "Wasm - opcodes" {
try testing.expectEqual(@as(u16, 0xC4), i64_extend32_s); try testing.expectEqual(@as(u16, 0xC4), i64_extend32_s);
} }
/// Opcodes that require a prefix `0xFC` /// Opcodes that require a prefix `0xFC`.
/// Each opcode represents a varuint32, meaning /// Each opcode represents a varuint32, meaning
/// they are encoded as leb128 in binary. /// they are encoded as leb128 in binary.
pub const MiscOpcode = enum(u32) { pub const MiscOpcode = enum(u32) {
@ -793,7 +793,7 @@ pub fn section(val: Section) u8 {
return @intFromEnum(val); return @intFromEnum(val);
} }
/// The kind of the type when importing or exporting to/from the host environment /// The kind of the type when importing or exporting to/from the host environment.
/// https://webassembly.github.io/spec/core/syntax/modules.html /// https://webassembly.github.io/spec/core/syntax/modules.html
pub const ExternalKind = enum(u8) { pub const ExternalKind = enum(u8) {
function, function,