From 7e9eeb6e39854089181721d9aa1299f1e2a456a0 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:33:53 -0800 Subject: [PATCH 1/3] feat(ts): translate dyn bytes::Buf as an object of Buf's methods Co-Authored-By: Claude Opus 5.5 --- quest/m3/README.md | 7 +- quest/m3/ts-buf-chain.md | 17 + quest/m3/ts-by-ref-place.md | 15 + quest/m3/ts-dyn-buf-size.md | 16 + quest/m3/ts-dyn.md | 9 +- quest/m3/ts-refcell-debug.md | 14 + quest/m3/ts-take-value.md | 14 + ts/README.md | 17 +- ts/fixtures/stock/expected/buf.Counted.ts | 1239 +++++ ts/fixtures/stock/expected/buf.Leased.ts | 384 ++ ts/fixtures/stock/expected/buf.Pieces.ts | 1598 +++++- ts/fixtures/stock/expected/buf.Provided.ts | 910 +++- ts/fixtures/stock/expected/buf.ts | 1365 ++++- ts/fixtures/stock/expected/bytes.ts | 5 + .../stock/expected/bytes/buf/buf_impl.Buf.ts | 4316 ++++++++++++++++ .../stock/expected/bytes/buf/buf_impl.ts | 4555 +++++++++++++++-- .../stock/expected/bytes/buf/take.Take.ts | 1284 +++++ ts/fixtures/stock/expected/bytes/buf/take.ts | 10 + ts/fixtures/stock/expected/core/cmp.ts | 9 + ts/fixtures/stock/expected/core/result.ts | 28 + ts/fixtures/stock/expected/harness.ts | 12 +- ts/fixtures/stock/src/buf.rs | 139 +- ts/fixtures/stock/src/harness.rs | 1 + ts/runtime/rt/bytes.ts | 54 + ts/src/lower/dynamic.rs | 14 +- ts/src/lower/stock.rs | 83 +- 26 files changed, 15386 insertions(+), 729 deletions(-) create mode 100644 quest/m3/ts-buf-chain.md create mode 100644 quest/m3/ts-by-ref-place.md create mode 100644 quest/m3/ts-dyn-buf-size.md create mode 100644 quest/m3/ts-refcell-debug.md create mode 100644 quest/m3/ts-take-value.md create mode 100644 ts/fixtures/stock/expected/buf.Counted.ts create mode 100644 ts/fixtures/stock/expected/buf.Leased.ts create mode 100644 ts/fixtures/stock/expected/bytes/buf/buf_impl.Buf.ts create mode 100644 ts/fixtures/stock/expected/bytes/buf/take.Take.ts create mode 100644 ts/fixtures/stock/expected/bytes/buf/take.ts create mode 100644 ts/fixtures/stock/expected/core/cmp.ts diff --git a/quest/m3/README.md b/quest/m3/README.md index 85050b626..fd27fc273 100644 --- a/quest/m3/README.md +++ b/quest/m3/README.md @@ -17,7 +17,12 @@ generic std gap is planned here even when moq never calls it. - [Relink without rebuilding](/quest/m3/relink.md) - measure upstream's skip of dependency-only rebuilds on moq's edits once it reaches nightly - [Unsafe code the translator can model](/quest/m3/ts-unsafe.md) - a dependency using only `unsafe` the translator can model translates from source - [The capacity of a BytesMut](/quest/m3/ts-bytes-capacity.md) - `BytesMut::capacity` and what reads it translate with `bytes`' values -- [Trait objects](/quest/m3/ts-dyn.md) - `dyn Error`, `dyn Iterator`, `dyn Buf`, and `Arc` translate, so a consumer neither rewrites nor binds them +- [Trait objects](/quest/m3/ts-dyn.md) - `dyn Error`, `dyn Iterator`, and `Arc` translate, so a consumer neither rewrites nor binds them +- [bytes' Chain as a Buf object](/quest/m3/ts-buf-chain.md) - `Chain::copy_to_bytes` across both halves translates, and with it a `Chain` as a `dyn Buf` +- [A Buf object's size](/quest/m3/ts-dyn-buf-size.md) - a `dyn Buf` object holds only the methods some call dispatches to +- [by_ref of a mutable reference to an iterator](/quest/m3/ts-by-ref-place.md) - `Iterator::by_ref` of a `&mut I` in a local translates +- [mem::take as a function value](/quest/m3/ts-take-value.md) - `mem::take`, `replace`, and `swap` passed as a function value translate +- [Debug of a RefCell](/quest/m3/ts-refcell-debug.md) - `{:?}` of a `RefCell`, `Ref`, and `RefMut` translates as std's writes them - [Placeholders written to a crate's own fmt::Write](/quest/m3/ts-fmt-calls.md) - `write!` with placeholders into a crate's own writer translates, its `write_str` seeing each call std makes - [Waiting: type-check in process with tsrs](/quest/m3/ts-tsrs.md) - rust2-ts checks bindings through tsrs instead of `tsc` once it is a stable library - [Drop order in std's folds and iterators](/quest/m3/ts-drop-order.md) - the values that drop still refused in std's consumers, flattens, and collects drop as std's do diff --git a/quest/m3/ts-buf-chain.md b/quest/m3/ts-buf-chain.md new file mode 100644 index 000000000..f0d52e801 --- /dev/null +++ b/quest/m3/ts-buf-chain.md @@ -0,0 +1,17 @@ +# [S] bytes' Chain as a Buf object + +## Goal + +[rust2-ts](/ts/README.md) translates `copy_to_bytes` of `bytes`' `Chain` across both +halves, and with it a `Chain` coerced to `dyn Buf`, whose object holds every method, +proven by a differential test against native Rust. + +## Plan + +Found writing `dyn Buf`: `Chain::copy_to_bytes` puts `&mut A` and a `Take<&mut B>` into a +fresh `BytesMut::with_capacity(len)`, refused as "`BufMut::put` of `&mut Bytes`" and as a +`put` that picks its methods by a capacity nothing counts. A buffer just made with a +capacity and never split has the capacity it asked for, so `put` into it can read the +source chunk by chunk, as the crate's own `copy_to_bytes` does. + +Public API: the translator's output. diff --git a/quest/m3/ts-by-ref-place.md b/quest/m3/ts-by-ref-place.md new file mode 100644 index 000000000..7c199a651 --- /dev/null +++ b/quest/m3/ts-by-ref-place.md @@ -0,0 +1,15 @@ +# [S] by_ref of a mutable reference to an iterator + +## Goal + +[rust2-ts](/ts/README.md) translates `Iterator::by_ref` of a `&mut I` held in a local, +such as `(&mut it).by_ref()` where `it: &mut I`, advancing the iterator it points at as +std's does, proven by a differential test against native Rust. + +## Plan + +Found writing [`dyn Iterator`](https://github.com/moq-dev/rust2/pull/437): it fails as +"`Iterator::by_ref` with a mutable reference to a value JS copies, which its mapping would +copy", since the `&mut I` itself is an `rt.Place`. + +Public API: the translator's output. diff --git a/quest/m3/ts-dyn-buf-size.md b/quest/m3/ts-dyn-buf-size.md new file mode 100644 index 000000000..2b07bdb13 --- /dev/null +++ b/quest/m3/ts-dyn-buf-size.md @@ -0,0 +1,16 @@ +# [S] A Buf object's size + +## Goal + +[rust2-ts](/ts/README.md)'s `dyn Buf` objects hold only the methods some call dispatches +to, so each buffer coerced to one adds a few functions to the output and not all of `Buf`'s. + +## Plan + +Found writing `dyn Buf`: an object holds every vtable entry, as the crate's own traits' +do, so the stock fixture's six buffers add about 5,000 lines of `bytes`' provided methods +translated from MIR. A crate's calls through `dyn Buf` name the methods it needs, but an +object passed to another crate may be called by methods this one never calls, so the +set has to be the dependents' too, or each method made on first call. + +Public API: the translator's output. diff --git a/quest/m3/ts-dyn.md b/quest/m3/ts-dyn.md index 681418e6a..61ccc2dfd 100644 --- a/quest/m3/ts-dyn.md +++ b/quest/m3/ts-dyn.md @@ -3,8 +3,9 @@ ## Goal [rust2-ts](/ts/README.md) translates the trait objects of std's and mapped crates' traits -that moq still refuses (`dyn Error`, `dyn Iterator`, and `dyn bytes::Buf`), and behind any -pointer std coerces to one, such as `Arc`, with Rust's dispatch and drop order, proven by differential tests against native Rust, so a consumer +that moq still refuses (`dyn Error` and `dyn Iterator`), and `dyn FusedIterator`, behind +any pointer std coerces to one, such as `Arc`, `&mut dyn Debug`, and +`Arc`, with Rust's dispatch and drop order, proven by differential tests against native Rust, so a consumer neither rewrites nor binds them. ## Plan @@ -18,7 +19,9 @@ config, so trait objects move from never to not yet. Build the rest on those. - `Error` needs `source` and its supertraits' `Debug` and `Display` on the object, and its `downcast_ref` can check classes as `dyn Any`'s does; moq's are thiserror's `source`. -- `Iterator` can be an `rt.Iter`, and `bytes::Buf` the `rt.ByteSlice` it reads. +- `Iterator` can be an `rt.Iter`. +- `bytes::Buf` is an object of its methods, as the crate's own traits are, decided with the + maintainer on 2026-11-02, so it works for any implementor. - `Arc` is refused where it is built, found by [#247](https://github.com/moq-dev/rust2/pull/247) on 2026-10-29: `Arc`, `Rc`, and `Box` of a trait object take the same object as a `&dyn`, behind the pointer's own counts. diff --git a/quest/m3/ts-refcell-debug.md b/quest/m3/ts-refcell-debug.md new file mode 100644 index 000000000..7acf62ffc --- /dev/null +++ b/quest/m3/ts-refcell-debug.md @@ -0,0 +1,14 @@ +# [XS] Debug of a RefCell + +## Goal + +[rust2-ts](/ts/README.md) translates `{:?}` of a `RefCell` and its `Ref` and `RefMut`, +writing `RefCell { value: .. }` and `` while mutably borrowed as std's does, +proven by a differential test against native Rust. + +## Plan + +Found writing [`Box`](https://github.com/moq-dev/rust2/pull/445): it is an +"unsupported call to `> as Debug>::fmt`". + +Public API: the translator's output. diff --git a/quest/m3/ts-take-value.md b/quest/m3/ts-take-value.md new file mode 100644 index 000000000..86ae6102b --- /dev/null +++ b/quest/m3/ts-take-value.md @@ -0,0 +1,14 @@ +# [XS] mem::take as a function value + +## Goal + +[rust2-ts](/ts/README.md) translates `std::mem::take`, `replace`, and `swap` passed as a +function value, such as `v.iter_mut().map(std::mem::take)`, as their calls do, proven by a +differential test against native Rust. + +## Plan + +Found writing [`dyn Iterator`](https://github.com/moq-dev/rust2/pull/437): the call maps, +but the function value is an "unsupported call to `std::mem::take::>`". + +Public API: the translator's output. diff --git a/ts/README.md b/ts/README.md index cadf317f4..3ce3efb32 100644 --- a/ts/README.md +++ b/ts/README.md @@ -441,7 +441,7 @@ as its fold ends, before what it wraps, as std's does. A `Vec`'s `drain` leaves what precedes its range until it drops, then drops what it still holds and moves the tail back, so one never dropped, as `mem::forget` leaves it, leaks the rest, as std's does. -A trait object of the crate's own trait, or a dependency's, behind `&`, `&mut`, `Box`, or `Arc`, is an object with +A trait object of the crate's own trait, a dependency's, or `bytes`' `Buf`, behind `&`, `&mut`, `Box`, or `Arc`, is an object with a method for each function a call can dispatch to, its supertraits' included, named for its trait as an impl's function is and taking what follows `self`: `shape.area$Shape()`. The trait's module exports its type, `Shape.Shape` from `dyns.Shape.ts`, which a TS @@ -453,7 +453,8 @@ same object. A `Box` drops what it holds through its `[Symbol.dispose a TS caller's object may leave out. An `Arc` unsized to an `Arc`, or to an `Arc`, is an `rt.ArcDyn`: the object a box of its value would be, and the `Arc` it was made from, whose one count both sides' clones and drops change, and the -last of which drops the value. `Arc::ptr_eq` compares the `Arc`s. +last of which drops the value. `Arc::ptr_eq` compares the `Arc`s. A `dyn Buf`'s object +holds no `chunks_vectored`, whose `IoSlice` has no JS value, so a call of it fails. A `dyn Any` is such an object with no methods, whose class `is`, `downcast_ref`, `downcast_mut`, and `Box`'s and `Arc`'s `downcast` check for: `a instanceof Any.of$dyns_Square ? @@ -467,7 +468,7 @@ that `Fn` or `FnMut` calls, boxed as a `dyn FnOnce`, is `rt.once` of it, which d after the call, as an `FnOnce` closure's body drops what it owns, and a box of a reference to one is `rt.lent` of it, which never drops it. A trait object of std's or a mapped crate's trait other than `&dyn Debug`, `&dyn Display`, `dyn Future`, -`dyn Any`, and the function traits, of a generic +`dyn Any`, `dyn Buf`, and the function traits, of a generic trait or one with an associated type, of a byte array, or behind any other pointer, such as a `Weak` or a struct's last field, is refused, and so are an upcast to `dyn Any` and `Any::type_id`. @@ -528,11 +529,15 @@ of them: `split_off`, `try_reclaim`, `try_unsplit`, and `spare_capacity_mut`, which read it. - `Buf` and `BufMut` of a `Bytes`, a `BytesMut`, a `&[u8]`, and a `Vec` map: the required methods, `has_remaining`, `copy_to_slice`, `copy_to_bytes`, each `get_` and - `put_` of an integer or a float, `put_slice`, `put_bytes`, and `put`, whose panics are + `put_` of an integer or a float, each `try_get_` of an integer of 2 to 16 bytes, + `put_slice`, `put_bytes`, and `put`, whose panics are `bytes`'. `put` of the crate's own `Buf` into a `Vec` reads it through its methods as `bytes` does, and into a `BytesMut` is refused, as `bytes` picks those methods by its capacity. The provided `copy_to_bytes` of the crate's own `Buf`, whose `BytesMut` has - the capacity it asks for, reads it chunk by chunk through its methods. + the capacity it asks for, reads it chunk by chunk through its methods. The provided + `get_` and `try_get_` of an integer of 2 to 16 bytes of any other `Buf`, such as a + `Take`, read its chunk where that holds the integer, and copy it out through + `copy_to_slice` where not, as `bytes`' do. The impls forwarding through a `&mut` or a `Box` translate from `bytes`' MIR, and the `BufMut` methods they don't forward map as the buffer's own, but `put` and `put_bytes`, which grow it as their provided bodies do, 64 bytes at a time once it is full. `put` of @@ -837,7 +842,7 @@ they need. Byte reinterpretation, pointer arithmetic and addresses, raw allocation, and unions whose fields overlap in different types ([unsafe](/quest/m3/ts-unsafe.md)), and trait objects other than -`&dyn Debug`, `&dyn Display`, `dyn Future`, `dyn Any`, `dyn Fn*`, and the translated crates' traits' +`&dyn Debug`, `&dyn Display`, `dyn Future`, `dyn Any`, `dyn Fn*`, `dyn Buf`, and the translated crates' traits' behind `&`, `&mut`, `Box`, or `Arc` ([trait objects](/quest/m3/ts-dyn.md)), fail translation. Until they translate, an item that needs one, such as a `dyn Error`, binds to hand-written TS ([bindings](#bindings)). diff --git a/ts/fixtures/stock/expected/buf.Counted.ts b/ts/fixtures/stock/expected/buf.Counted.ts new file mode 100644 index 000000000..d4e2b5bfc --- /dev/null +++ b/ts/fixtures/stock/expected/buf.Counted.ts @@ -0,0 +1,1239 @@ +// Generated by rust2-ts. Do not edit. + +import * as rt from "./rt.ts"; +import * as Pieces from "./buf.Pieces.ts"; +import { panicAdvance, panicDoesNotFit } from "./bytes.ts"; +import { signExtend } from "./bytes/buf/buf_impl.ts"; +import type * as TryGetError from "./bytes.TryGetError.ts"; +import { unwrapOrElse$1wp5sd9 as result_unwrapOrElse$1wp5sd9, unwrapOrElse$0s2lrc9 as result_unwrapOrElse$0s2lrc9 } from "./core/result.ts"; + +/** Pieces that count their drops. */ +export class Counted { + _0: Pieces.Pieces; + _1: rt.Arc>; + + constructor(_0: Pieces.Pieces, _1: rt.Arc>) { + this._0 = _0; + this._1 = _1; + } + + [Symbol.dispose](): void { + drop$ops_Drop(this); + this._1[Symbol.dispose](); + } +} + +/** + * Returns the number of bytes between the current position and the end of + * the buffer. + * + * This value is greater than or equal to the length of the slice returned + * by `chunk()`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.remaining(), 11); + * + * buf.get_u8(); + * + * assert_eq!(buf.remaining(), 10); + * ``` + * + * # Implementer notes + * + * Implementations of `remaining` should ensure that the return value does + * not change unless a call is made to `advance` or any other function that + * is documented to change the `Buf`'s current position. + */ +export function remaining$bytes_Buf(self: Counted): rt.usize { + return Pieces.remaining$bytes_Buf(self._0); +} + +/** + * Returns a slice starting at the current position and of length between 0 + * and `Buf::remaining()`. Note that this *can* return a shorter slice (this + * allows non-continuous internal representation). + * + * This is a lower level function. Most operations are done with other + * functions. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.chunk(), &b"hello world"[..]); + * + * buf.advance(6); + * + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` + * + * # Implementer notes + * + * This function should never panic. `chunk()` should return an empty + * slice **if and only if** `remaining()` returns 0. In other words, + * `chunk()` returning an empty slice implies that `remaining()` will + * return 0 and `remaining()` returning 0 implies that `chunk()` will + * return an empty slice. + */ +export function chunk$bytes_Buf(self: Counted): rt.ByteSlice { + return Pieces.chunk$bytes_Buf(self._0); +} + +/** + * Advance the internal cursor of the Buf + * + * The next call to `chunk()` will return a slice starting `cnt` bytes + * further into the underlying buffer. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.chunk(), &b"hello world"[..]); + * + * buf.advance(6); + * + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` + * + * # Panics + * + * This function **may** panic if `cnt > self.remaining()`. + * + * # Implementer notes + * + * It is recommended for implementations of `advance` to panic if `cnt > + * self.remaining()`. If the implementation does not panic, the call must + * behave as if `cnt == self.remaining()`. + * + * A call with `cnt == 0` should never panic and be a no-op. + */ +export function advance$bytes_Buf(self: Counted, cnt: rt.usize): void { + Pieces.advance$bytes_Buf(self._0, cnt); +} + +export function drop$ops_Drop(self: Counted): void { + rt.cellSet(self._1.value, rt.u8Add(self._1.value.v, 1)); +} + +/** + * Returns true if there are any more bytes to consume + * + * This is equivalent to `self.remaining() != 0`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"a"[..]; + * + * assert!(buf.has_remaining()); + * + * buf.get_u8(); + * + * assert!(!buf.has_remaining()); + * ``` + */ +export function hasRemaining$bytes_Buf(self: Counted): boolean { + return remaining$bytes_Buf(self) > 0; +} + +/** + * Copies bytes from `self` into `dst`. + * + * The cursor is advanced by the number of bytes copied. `self` must have + * enough remaining bytes to fill `dst`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 5]; + * + * buf.copy_to_slice(&mut dst); + * assert_eq!(&b"hello"[..], &dst); + * assert_eq!(6, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `self.remaining() < dst.len()`. + */ +export function copyToSlice$bytes_Buf(self: Counted, dst: rt.ByteSlice): void { + result_unwrapOrElse$0s2lrc9(tryCopyToSlice$bytes_Buf(self, dst), (error: TryGetError.TryGetError): undefined => { + panicAdvance(error); + }); +} + +/** + * Gets an unsigned 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(8, buf.get_u8()); + * ``` + * + * # Panics + * + * This function panics if there is no more remaining data in `self`. + */ +export function getU8$bytes_Buf(self: Counted): rt.u8 { + if (!(remaining$bytes_Buf_mut(self) < 1)) { + const _7: rt.ByteSlice = chunk$bytes_Buf_mut(self); + rt.idx(_7, 0); + const ret: rt.u8 = _7.data[_7.start]; + advance$bytes_Buf(self, 1); + return ret; + } + panicAdvance({ requested: 1, available: 0 }); +} + +/** + * Gets a signed 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(8, buf.get_i8()); + * ``` + * + * # Panics + * + * This function panics if there is no more remaining data in `self`. + */ +export function getI8$bytes_Buf(self: Counted): rt.i8 { + if (!(remaining$bytes_Buf_mut(self) < 1)) { + const _8: rt.ByteSlice = chunk$bytes_Buf_mut(self); + rt.idx(_8, 0); + const ret: rt.i8 = (_8.data[_8.start] << 24) >> 24; + advance$bytes_Buf(self, 1); + return ret; + } + panicAdvance({ requested: 1, available: 0 }); +} + +/** + * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(0x010203, buf.get_uint(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUint$bytes_Buf(self: Counted, nbytes: rt.usize): rt.u64 { + return result_unwrapOrElse$1wp5sd9(((): rt.Result => { + const _2: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_2 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _2; + const buf: Uint8Array = rt.bytes(8); + const _9: rt.Result = tryCopyToSlice$bytes_Buf(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_9.ok) { + return rt.Ok(rt.u64FromBeBytes(buf)); + } + return _9; + } + })(), (error: TryGetError.TryGetError): rt.u64 => { + panicAdvance(error); + }); +} + +/** + * Gets an unsigned n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(0x010203, buf.get_uint_le(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUintLe$bytes_Buf(self: Counted, nbytes: rt.usize): rt.u64 { + return result_unwrapOrElse$1wp5sd9(((): rt.Result => { + const buf: Uint8Array = rt.bytes(8); + const _32: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_32 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _12: rt.Result = tryCopyToSlice$bytes_Buf(self, _32); + if (_12.ok) { + return rt.Ok(rt.u64FromBeBytes(buf.slice().reverse())); + } + return _12; + } + })(), (error: TryGetError.TryGetError): rt.u64 => { + panicAdvance(error); + }); +} + +/** + * Gets an unsigned n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(0x010203, buf.get_uint_ne(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUintNe$bytes_Buf(self: Counted, nbytes: rt.usize): rt.u64 { + return getUintLe$bytes_Buf(self, nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(0x010203, buf.get_int(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getInt$bytes_Buf(self: Counted, nbytes: rt.usize): rt.i64 { + return signExtend(getUint$bytes_Buf(self, nbytes), nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(0x010203, buf.get_int_le(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getIntLe$bytes_Buf(self: Counted, nbytes: rt.usize): rt.i64 { + return signExtend(getUintLe$bytes_Buf(self, nbytes), nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(0x010203, buf.get_int_ne(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getIntNe$bytes_Buf(self: Counted, nbytes: rt.usize): rt.i64 { + return getIntLe$bytes_Buf(self, nbytes); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\x99\x99\x9A hello"[..]; + * assert_eq!(1.2f32, buf.get_f32()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32$bytes_Buf(self: Counted): rt.f32 { + return rt.f32FromBits(rt.bufGet(self, 4, false, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Counted, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Counted, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32Le$bytes_Buf(self: Counted): rt.f32 { + return rt.f32FromBits(rt.bufGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Counted, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Counted, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\x99\x99\x9A hello", + * false => b"\x9A\x99\x99\x3F hello", + * }; + * assert_eq!(1.2f32, buf.get_f32_ne()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32Ne$bytes_Buf(self: Counted): rt.f32 { + return rt.f32FromBits(rt.bufGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Counted, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Counted, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64$bytes_Buf(self: Counted): rt.f64 { + return rt.f64FromBits(rt.bufGet(self, 8, false, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Counted, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Counted, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello"[..]; + * assert_eq!(1.2f64, buf.get_f64_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64Le$bytes_Buf(self: Counted): rt.f64 { + return rt.f64FromBits(rt.bufGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Counted, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Counted, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello", + * false => b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello", + * }; + * assert_eq!(1.2f64, buf.get_f64_ne()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64Ne$bytes_Buf(self: Counted): rt.f64 { + return rt.f64FromBits(rt.bufGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Counted, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Counted, a1: rt.ByteSlice) => undefined)); +} + +/** + * Copies bytes from `self` into `dst`. + * + * The cursor is advanced by the number of bytes copied. `self` must have + * enough remaining bytes to fill `dst`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 5]; + * + * assert_eq!(Ok(()), buf.try_copy_to_slice(&mut dst)); + * assert_eq!(&b"hello"[..], &dst); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 12]; + * + * assert_eq!(Err(TryGetError{requested: 12, available: 11}), buf.try_copy_to_slice(&mut dst)); + * assert_eq!(11, buf.remaining()); + * ``` + */ +export function tryCopyToSlice$bytes_Buf(self: Counted, dst: rt.ByteSlice): rt.Result { + if (!(remaining$bytes_Buf_mut(self) < dst.length)) { + while (!(dst.length === 0)) { + const src: rt.ByteSlice = chunk$bytes_Buf_mut(self); + const cnt: rt.usize = rt.min(src.length, dst.length); + rt.byteSliceCopyFromSlice(rt.byteSliceRange(dst, 0, cnt), rt.byteSliceRange(src, 0, cnt)); + dst = rt.byteSliceRange(dst, cnt); + advance$bytes_Buf(self, cnt); + } + return rt.OK; + } + return rt.Err({ requested: dst.length, available: remaining$bytes_Buf_mut(self) }); +} + +/** + * Gets an unsigned 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_u8), buf.try_get_u8()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_u8()); + * ``` + */ +export function tryGetU8$bytes_Buf(self: Counted): rt.u8 | undefined { + if (!(remaining$bytes_Buf_mut(self) < 1)) { + const _9: rt.ByteSlice = chunk$bytes_Buf_mut(self); + rt.idx(_9, 0); + const ret: rt.u8 = _9.data[_9.start]; + advance$bytes_Buf(self, 1); + return ret; + } + tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut(self) }; + return undefined; +} + +export const tryGetU8Out$bytes_Buf: { err: unknown } = { err: undefined }; + +/** + * Gets a signed 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_i8), buf.try_get_i8()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_i8()); + * ``` + */ +export function tryGetI8$bytes_Buf(self: Counted): rt.i8 | undefined { + if (!(remaining$bytes_Buf_mut(self) < 1)) { + const _10: rt.ByteSlice = chunk$bytes_Buf_mut(self); + rt.idx(_10, 0); + const ret: rt.i8 = (_10.data[_10.start] << 24) >> 24; + advance$bytes_Buf(self, 1); + return ret; + } + tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut(self) }; + return undefined; +} + +export const tryGetI8Out$bytes_Buf: { err: unknown } = { err: undefined }; + +/** + * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` > 8. + */ +export function tryGetUint$bytes_Buf(self: Counted, nbytes: rt.usize): rt.u64 | undefined { + const _3: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_3 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _3; + const buf: Uint8Array = rt.bytes(8); + const _8: rt.Result = tryCopyToSlice$bytes_Buf(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_8.ok) { + return rt.u64FromBeBytes(buf); + } + tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +export const tryGetUintOut$bytes_Buf: { err: unknown } = { err: undefined }; + +/** + * Gets an unsigned n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint_le(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint_le(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` > 8. + */ +export function tryGetUintLe$bytes_Buf(self: Counted, nbytes: rt.usize): rt.u64 | undefined { + const buf: Uint8Array = rt.bytes(8); + const _4: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_4 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _11: rt.Result = tryCopyToSlice$bytes_Buf(self, _4); + if (_11.ok) { + return rt.u64FromBeBytes(buf.slice().reverse()); + } + tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets an unsigned n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint_ne(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03", + * false => b"\x03\x02\x01", + * }; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint_ne(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetUintNe$bytes_Buf(self: Counted, nbytes: rt.usize): rt.u64 | undefined { + return tryGetUintLe$bytes_Buf(self, nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetInt$bytes_Buf(self: Counted, nbytes: rt.usize): rt.i64 | undefined { + const _3: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_3 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _3; + const buf: Uint8Array = rt.bytes(8); + const _8: rt.Result = tryCopyToSlice$bytes_Buf(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_8.ok) { + return rt.i64FromBeBytes(buf); + } + tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +export const tryGetIntOut$bytes_Buf: { err: unknown } = { err: undefined }; + +/** + * Gets a signed n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int_le(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int_le(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetIntLe$bytes_Buf(self: Counted, nbytes: rt.usize): rt.i64 | undefined { + const buf: Uint8Array = rt.bytes(8); + const _4: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_4 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _11: rt.Result = tryCopyToSlice$bytes_Buf(self, _4); + if (_11.ok) { + return rt.i64FromBeBytes(buf.slice().reverse()); + } + tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets a signed n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int_ne(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03", + * false => b"\x03\x02\x01", + * }; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int_ne(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetIntNe$bytes_Buf(self: Counted, nbytes: rt.usize): rt.i64 | undefined { + return tryGetIntLe$bytes_Buf(self, nbytes); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\x99\x99\x9A hello"[..]; + * assert_eq!(1.2f32, buf.get_f32()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32$bytes_Buf(self: Counted): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, false, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Counted, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Counted, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +export const tryGetF32Out$bytes_Buf: { err: unknown } = { err: undefined }; + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32_le()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32Le$bytes_Buf(self: Counted): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Counted, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Counted, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\x99\x99\x9A hello", + * false => b"\x9A\x99\x99\x3F hello", + * }; + * assert_eq!(1.2f32, buf.get_f32_ne()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32_ne()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32Ne$bytes_Buf(self: Counted): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Counted, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Counted, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64$bytes_Buf(self: Counted): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, false, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Counted, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Counted, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +export const tryGetF64Out$bytes_Buf: { err: unknown } = { err: undefined }; + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello"[..]; + * assert_eq!(1.2f64, buf.get_f64_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64_le()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64Le$bytes_Buf(self: Counted): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Counted, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Counted, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello", + * false => b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello", + * }; + * assert_eq!(1.2f64, buf.get_f64_ne()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64_ne()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64Ne$bytes_Buf(self: Counted): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Counted, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Counted, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Returns a slice starting at the current position and of length between 0 + * and `Buf::remaining()`. Note that this *can* return a shorter slice (this + * allows non-continuous internal representation). + * + * This is a lower level function. Most operations are done with other + * functions. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.chunk(), &b"hello world"[..]); + * + * buf.advance(6); + * + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` + * + * # Implementer notes + * + * This function should never panic. `chunk()` should return an empty + * slice **if and only if** `remaining()` returns 0. In other words, + * `chunk()` returning an empty slice implies that `remaining()` will + * return 0 and `remaining()` returning 0 implies that `chunk()` will + * return an empty slice. + */ +export function chunk$bytes_Buf_mut(self: Counted): rt.ByteSlice { + return chunk$bytes_Buf(self); +} + +/** + * Returns the number of bytes between the current position and the end of + * the buffer. + * + * This value is greater than or equal to the length of the slice returned + * by `chunk()`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.remaining(), 11); + * + * buf.get_u8(); + * + * assert_eq!(buf.remaining(), 10); + * ``` + * + * # Implementer notes + * + * Implementations of `remaining` should ensure that the return value does + * not change unless a call is made to `advance` or any other function that + * is documented to change the `Buf`'s current position. + */ +export function remaining$bytes_Buf_mut(self: Counted): rt.usize { + return remaining$bytes_Buf(self); +} + +//# sourceMappingURL=buf.Counted.ts.map diff --git a/ts/fixtures/stock/expected/buf.Leased.ts b/ts/fixtures/stock/expected/buf.Leased.ts new file mode 100644 index 000000000..3d5f83cb3 --- /dev/null +++ b/ts/fixtures/stock/expected/buf.Leased.ts @@ -0,0 +1,384 @@ +// Generated by rust2-ts. Do not edit. + +import * as rt from "./rt.ts"; +import * as Counted from "./buf.Counted.ts"; +import * as Pieces from "./buf.Pieces.ts"; +import type * as TryGetError from "./bytes.TryGetError.ts"; + +/** A buffer of the crate's own over `Buf`, as moq's transports lend a stream's chunks. */ +export type Leased = + | { pieces$Leased: () => rt.usize; remaining$Buf: () => rt.usize; chunk$Buf: () => rt.ByteSlice; advance$Buf: (a0: rt.usize) => void; hasRemaining$Buf: () => boolean; copyToSlice$Buf: (a0: rt.ByteSlice) => void; getU8$Buf: () => rt.u8; getI8$Buf: () => rt.i8; getU16$Buf: () => rt.u16; getU16Le$Buf: () => rt.u16; getU16Ne$Buf: () => rt.u16; getI16$Buf: () => rt.i16; getI16Le$Buf: () => rt.i16; getI16Ne$Buf: () => rt.i16; getU32$Buf: () => rt.u32; getU32Le$Buf: () => rt.u32; getU32Ne$Buf: () => rt.u32; getI32$Buf: () => rt.i32; getI32Le$Buf: () => rt.i32; getI32Ne$Buf: () => rt.i32; getU64$Buf: () => rt.u64; getU64Le$Buf: () => rt.u64; getU64Ne$Buf: () => rt.u64; getI64$Buf: () => rt.i64; getI64Le$Buf: () => rt.i64; getI64Ne$Buf: () => rt.i64; getU128$Buf: () => rt.u128; getU128Le$Buf: () => rt.u128; getU128Ne$Buf: () => rt.u128; getI128$Buf: () => rt.i128; getI128Le$Buf: () => rt.i128; getI128Ne$Buf: () => rt.i128; getUint$Buf: (a0: rt.usize) => rt.u64; getUintLe$Buf: (a0: rt.usize) => rt.u64; getUintNe$Buf: (a0: rt.usize) => rt.u64; getInt$Buf: (a0: rt.usize) => rt.i64; getIntLe$Buf: (a0: rt.usize) => rt.i64; getIntNe$Buf: (a0: rt.usize) => rt.i64; getF32$Buf: () => rt.f32; getF32Le$Buf: () => rt.f32; getF32Ne$Buf: () => rt.f32; getF64$Buf: () => rt.f64; getF64Le$Buf: () => rt.f64; getF64Ne$Buf: () => rt.f64; tryCopyToSlice$Buf: (a0: rt.ByteSlice) => rt.Result; tryGetU8$Buf: () => rt.Result; tryGetI8$Buf: () => rt.Result; tryGetU16$Buf: () => rt.Result; tryGetU16Le$Buf: () => rt.Result; tryGetU16Ne$Buf: () => rt.Result; tryGetI16$Buf: () => rt.Result; tryGetI16Le$Buf: () => rt.Result; tryGetI16Ne$Buf: () => rt.Result; tryGetU32$Buf: () => rt.Result; tryGetU32Le$Buf: () => rt.Result; tryGetU32Ne$Buf: () => rt.Result; tryGetI32$Buf: () => rt.Result; tryGetI32Le$Buf: () => rt.Result; tryGetI32Ne$Buf: () => rt.Result; tryGetU64$Buf: () => rt.Result; tryGetU64Le$Buf: () => rt.Result; tryGetU64Ne$Buf: () => rt.Result; tryGetI64$Buf: () => rt.Result; tryGetI64Le$Buf: () => rt.Result; tryGetI64Ne$Buf: () => rt.Result; tryGetU128$Buf: () => rt.Result; tryGetU128Le$Buf: () => rt.Result; tryGetU128Ne$Buf: () => rt.Result; tryGetI128$Buf: () => rt.Result; tryGetI128Le$Buf: () => rt.Result; tryGetI128Ne$Buf: () => rt.Result; tryGetUint$Buf: (a0: rt.usize) => rt.Result; tryGetUintLe$Buf: (a0: rt.usize) => rt.Result; tryGetUintNe$Buf: (a0: rt.usize) => rt.Result; tryGetInt$Buf: (a0: rt.usize) => rt.Result; tryGetIntLe$Buf: (a0: rt.usize) => rt.Result; tryGetIntNe$Buf: (a0: rt.usize) => rt.Result; tryGetF32$Buf: () => rt.Result; tryGetF32Le$Buf: () => rt.Result; tryGetF32Ne$Buf: () => rt.Result; tryGetF64$Buf: () => rt.Result; tryGetF64Le$Buf: () => rt.Result; tryGetF64Ne$Buf: () => rt.Result; copyToBytes$Buf: (a0: rt.usize) => rt.ByteSlice }; + +export class of$buf_Pieces { + v: Pieces.Pieces; + + constructor(v: Pieces.Pieces) { + this.v = v; + } + + advance$Buf(a: rt.usize): void { + return Pieces.advance$bytes_Buf(this.v, a); + } + + chunk$Buf(): rt.ByteSlice { + return Pieces.chunk$bytes_Buf(this.v); + } + + copyToBytes$Buf(a: rt.usize): rt.ByteSlice { + return Pieces.copyToBytes$bytes_Buf(this.v, a); + } + + copyToSlice$Buf(a: rt.ByteSlice): void { + return Pieces.copyToSlice$bytes_Buf(this.v, a); + } + + getF32$Buf(): rt.f32 { + return Pieces.getF32$bytes_Buf(this.v); + } + + getF32Le$Buf(): rt.f32 { + return Pieces.getF32Le$bytes_Buf(this.v); + } + + getF32Ne$Buf(): rt.f32 { + return Pieces.getF32Ne$bytes_Buf(this.v); + } + + getF64$Buf(): rt.f64 { + return Pieces.getF64$bytes_Buf(this.v); + } + + getF64Le$Buf(): rt.f64 { + return Pieces.getF64Le$bytes_Buf(this.v); + } + + getF64Ne$Buf(): rt.f64 { + return Pieces.getF64Ne$bytes_Buf(this.v); + } + + getI128$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, false, rt.i128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI128Le$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, true, rt.i128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI128Ne$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, true, rt.i128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI16$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, false, rt.i16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI16Le$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, true, rt.i16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI16Ne$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, true, rt.i16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI32$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, false, rt.i32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI32Le$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, true, rt.i32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI32Ne$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, true, rt.i32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI64$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, false, rt.i64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI64Le$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, true, rt.i64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI64Ne$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, true, rt.i64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI8$Buf(): rt.i8 { + return Pieces.getI8$bytes_Buf(this.v); + } + + getInt$Buf(a: rt.usize): rt.i64 { + return Pieces.getInt$bytes_Buf(this.v, a); + } + + getIntLe$Buf(a: rt.usize): rt.i64 { + return Pieces.getIntLe$bytes_Buf(this.v, a); + } + + getIntNe$Buf(a: rt.usize): rt.i64 { + return Pieces.getIntNe$bytes_Buf(this.v, a); + } + + getU128$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, false, rt.u128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU128Le$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, true, rt.u128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU128Ne$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, true, rt.u128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU16$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, false, rt.u16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU16Le$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, true, rt.u16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU16Ne$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, true, rt.u16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU32$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, false, rt.u32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU32Le$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, true, rt.u32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU32Ne$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, true, rt.u32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU64$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, false, rt.u64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU64Le$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, true, rt.u64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU64Ne$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, true, rt.u64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU8$Buf(): rt.u8 { + return Pieces.getU8$bytes_Buf(this.v); + } + + getUint$Buf(a: rt.usize): rt.u64 { + return Pieces.getUint$bytes_Buf(this.v, a); + } + + getUintLe$Buf(a: rt.usize): rt.u64 { + return Pieces.getUintLe$bytes_Buf(this.v, a); + } + + getUintNe$Buf(a: rt.usize): rt.u64 { + return Pieces.getUintNe$bytes_Buf(this.v, a); + } + + hasRemaining$Buf(): boolean { + return Pieces.hasRemaining$bytes_Buf(this.v); + } + + pieces$Leased(): rt.usize { + return Pieces.pieces$buf_Leased(this.v); + } + + remaining$Buf(): rt.usize { + return Pieces.remaining$bytes_Buf(this.v); + } + + tryCopyToSlice$Buf(a: rt.ByteSlice): rt.Result { + return Pieces.tryCopyToSlice$bytes_Buf(this.v, a); + } + + tryGetF32$Buf(): rt.Result { + const part = Pieces.tryGetF32$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Le$Buf(): rt.Result { + const part = Pieces.tryGetF32Le$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Ne$Buf(): rt.Result { + const part = Pieces.tryGetF32Ne$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64$Buf(): rt.Result { + const part = Pieces.tryGetF64$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Le$Buf(): rt.Result { + const part = Pieces.tryGetF64Le$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Ne$Buf(): rt.Result { + const part = Pieces.tryGetF64Ne$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetI128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.i128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.i16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.i32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.i64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI8$Buf(): rt.Result { + const part = Pieces.tryGetI8$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetInt$Buf(a: rt.usize): rt.Result { + const part = Pieces.tryGetInt$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntLe$Buf(a: rt.usize): rt.Result { + const part = Pieces.tryGetIntLe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntNe$Buf(a: rt.usize): rt.Result { + const part = Pieces.tryGetIntNe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetU128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.u128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.u16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.u32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.u64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU8$Buf(): rt.Result { + const part = Pieces.tryGetU8$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUint$Buf(a: rt.usize): rt.Result { + const part = Pieces.tryGetUint$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintLe$Buf(a: rt.usize): rt.Result { + const part = Pieces.tryGetUintLe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintNe$Buf(a: rt.usize): rt.Result { + const part = Pieces.tryGetUintNe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } +} + +//# sourceMappingURL=buf.Leased.ts.map diff --git a/ts/fixtures/stock/expected/buf.Pieces.ts b/ts/fixtures/stock/expected/buf.Pieces.ts index 18705c868..301a5d94c 100644 --- a/ts/fixtures/stock/expected/buf.Pieces.ts +++ b/ts/fixtures/stock/expected/buf.Pieces.ts @@ -1,9 +1,11 @@ // Generated by rust2-ts. Do not edit. import * as rt from "./rt.ts"; -import { panicAdvance } from "./bytes.ts"; +import * as Counted from "./buf.Counted.ts"; +import { panicAdvance, panicDoesNotFit } from "./bytes.ts"; +import { signExtend } from "./bytes/buf/buf_impl.ts"; import type * as TryGetError from "./bytes.TryGetError.ts"; -import { unwrapOrElse$0s2lrc9 as result_unwrapOrElse$0s2lrc9 } from "./core/result.ts"; +import { unwrapOrElse$1wp5sd9 as result_unwrapOrElse$1wp5sd9, unwrapOrElse$0s2lrc9 as result_unwrapOrElse$0s2lrc9 } from "./core/result.ts"; /** A buffer of the crate's own, in pieces: `Buf`'s provided methods read across them. */ export interface Pieces { @@ -175,60 +177,1299 @@ export function copyToBytes$bytes_Buf(self: Pieces, len: rt.usize): rt.ByteSlice return rt.bytesMutFreeze(out); } +export function pieces$buf_Leased(self: Pieces): rt.usize { + return self.parts.length; +} + +/** + * Returns true if there are any more bytes to consume + * + * This is equivalent to `self.remaining() != 0`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"a"[..]; + * + * assert!(buf.has_remaining()); + * + * buf.get_u8(); + * + * assert!(!buf.has_remaining()); + * ``` + */ +export function hasRemaining$bytes_Buf(self: Pieces): boolean { + return remaining$bytes_Buf(self) > 0; +} + +/** + * Copies bytes from `self` into `dst`. + * + * The cursor is advanced by the number of bytes copied. `self` must have + * enough remaining bytes to fill `dst`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 5]; + * + * buf.copy_to_slice(&mut dst); + * assert_eq!(&b"hello"[..], &dst); + * assert_eq!(6, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `self.remaining() < dst.len()`. + */ +export function copyToSlice$bytes_Buf(self: Pieces, dst: rt.ByteSlice): void { + result_unwrapOrElse$0s2lrc9(tryCopyToSlice$bytes_Buf(self, dst), (error: TryGetError.TryGetError): undefined => { + panicAdvance(error); + }); +} + +/** + * Gets an unsigned 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(8, buf.get_u8()); + * ``` + * + * # Panics + * + * This function panics if there is no more remaining data in `self`. + */ +export function getU8$bytes_Buf(self: Pieces): rt.u8 { + if (!(remaining$bytes_Buf_mut(self) < 1)) { + const _7: rt.ByteSlice = chunk$bytes_Buf_mut(self); + rt.idx(_7, 0); + const ret: rt.u8 = _7.data[_7.start]; + advance$bytes_Buf(self, 1); + return ret; + } + panicAdvance({ requested: 1, available: 0 }); +} + +/** + * Gets a signed 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(8, buf.get_i8()); + * ``` + * + * # Panics + * + * This function panics if there is no more remaining data in `self`. + */ +export function getI8$bytes_Buf(self: Pieces): rt.i8 { + if (!(remaining$bytes_Buf_mut(self) < 1)) { + const _8: rt.ByteSlice = chunk$bytes_Buf_mut(self); + rt.idx(_8, 0); + const ret: rt.i8 = (_8.data[_8.start] << 24) >> 24; + advance$bytes_Buf(self, 1); + return ret; + } + panicAdvance({ requested: 1, available: 0 }); +} + +/** + * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(0x010203, buf.get_uint(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUint$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.u64 { + return result_unwrapOrElse$1wp5sd9(((): rt.Result => { + const _2: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_2 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _2; + const buf: Uint8Array = rt.bytes(8); + const _9: rt.Result = tryCopyToSlice$bytes_Buf(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_9.ok) { + return rt.Ok(rt.u64FromBeBytes(buf)); + } + return _9; + } + })(), (error: TryGetError.TryGetError): rt.u64 => { + panicAdvance(error); + }); +} + +/** + * Gets an unsigned n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(0x010203, buf.get_uint_le(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUintLe$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.u64 { + return result_unwrapOrElse$1wp5sd9(((): rt.Result => { + const buf: Uint8Array = rt.bytes(8); + const _32: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_32 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _12: rt.Result = tryCopyToSlice$bytes_Buf(self, _32); + if (_12.ok) { + return rt.Ok(rt.u64FromBeBytes(buf.slice().reverse())); + } + return _12; + } + })(), (error: TryGetError.TryGetError): rt.u64 => { + panicAdvance(error); + }); +} + +/** + * Gets an unsigned n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(0x010203, buf.get_uint_ne(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUintNe$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.u64 { + return getUintLe$bytes_Buf(self, nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(0x010203, buf.get_int(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getInt$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.i64 { + return signExtend(getUint$bytes_Buf(self, nbytes), nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(0x010203, buf.get_int_le(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getIntLe$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.i64 { + return signExtend(getUintLe$bytes_Buf(self, nbytes), nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(0x010203, buf.get_int_ne(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getIntNe$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.i64 { + return getIntLe$bytes_Buf(self, nbytes); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\x99\x99\x9A hello"[..]; + * assert_eq!(1.2f32, buf.get_f32()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32$bytes_Buf(self: Pieces): rt.f32 { + return rt.f32FromBits(rt.bufGet(self, 4, false, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32Le$bytes_Buf(self: Pieces): rt.f32 { + return rt.f32FromBits(rt.bufGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\x99\x99\x9A hello", + * false => b"\x9A\x99\x99\x3F hello", + * }; + * assert_eq!(1.2f32, buf.get_f32_ne()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32Ne$bytes_Buf(self: Pieces): rt.f32 { + return rt.f32FromBits(rt.bufGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64$bytes_Buf(self: Pieces): rt.f64 { + return rt.f64FromBits(rt.bufGet(self, 8, false, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello"[..]; + * assert_eq!(1.2f64, buf.get_f64_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64Le$bytes_Buf(self: Pieces): rt.f64 { + return rt.f64FromBits(rt.bufGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello", + * false => b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello", + * }; + * assert_eq!(1.2f64, buf.get_f64_ne()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64Ne$bytes_Buf(self: Pieces): rt.f64 { + return rt.f64FromBits(rt.bufGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined)); +} + +/** + * Copies bytes from `self` into `dst`. + * + * The cursor is advanced by the number of bytes copied. `self` must have + * enough remaining bytes to fill `dst`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 5]; + * + * assert_eq!(Ok(()), buf.try_copy_to_slice(&mut dst)); + * assert_eq!(&b"hello"[..], &dst); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 12]; + * + * assert_eq!(Err(TryGetError{requested: 12, available: 11}), buf.try_copy_to_slice(&mut dst)); + * assert_eq!(11, buf.remaining()); + * ``` + */ +export function tryCopyToSlice$bytes_Buf(self: Pieces, dst: rt.ByteSlice): rt.Result { + if (!(remaining$bytes_Buf_mut(self) < dst.length)) { + while (!(dst.length === 0)) { + const src: rt.ByteSlice = chunk$bytes_Buf_mut(self); + const cnt: rt.usize = rt.min(src.length, dst.length); + rt.byteSliceCopyFromSlice(rt.byteSliceRange(dst, 0, cnt), rt.byteSliceRange(src, 0, cnt)); + dst = rt.byteSliceRange(dst, cnt); + advance$bytes_Buf(self, cnt); + } + return rt.OK; + } + return rt.Err({ requested: dst.length, available: remaining$bytes_Buf_mut(self) }); +} + +/** + * Gets an unsigned 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_u8), buf.try_get_u8()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_u8()); + * ``` + */ +export function tryGetU8$bytes_Buf(self: Pieces): rt.u8 | undefined { + if (!(remaining$bytes_Buf_mut(self) < 1)) { + const _9: rt.ByteSlice = chunk$bytes_Buf_mut(self); + rt.idx(_9, 0); + const ret: rt.u8 = _9.data[_9.start]; + advance$bytes_Buf(self, 1); + return ret; + } + Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut(self) }; + return undefined; +} + +/** + * Gets a signed 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_i8), buf.try_get_i8()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_i8()); + * ``` + */ +export function tryGetI8$bytes_Buf(self: Pieces): rt.i8 | undefined { + if (!(remaining$bytes_Buf_mut(self) < 1)) { + const _10: rt.ByteSlice = chunk$bytes_Buf_mut(self); + rt.idx(_10, 0); + const ret: rt.i8 = (_10.data[_10.start] << 24) >> 24; + advance$bytes_Buf(self, 1); + return ret; + } + Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut(self) }; + return undefined; +} + +/** + * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` > 8. + */ +export function tryGetUint$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.u64 | undefined { + const _3: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_3 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _3; + const buf: Uint8Array = rt.bytes(8); + const _8: rt.Result = tryCopyToSlice$bytes_Buf(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_8.ok) { + return rt.u64FromBeBytes(buf); + } + Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets an unsigned n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint_le(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint_le(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` > 8. + */ +export function tryGetUintLe$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.u64 | undefined { + const buf: Uint8Array = rt.bytes(8); + const _4: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_4 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _11: rt.Result = tryCopyToSlice$bytes_Buf(self, _4); + if (_11.ok) { + return rt.u64FromBeBytes(buf.slice().reverse()); + } + Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets an unsigned n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint_ne(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03", + * false => b"\x03\x02\x01", + * }; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint_ne(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetUintNe$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.u64 | undefined { + return tryGetUintLe$bytes_Buf(self, nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetInt$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.i64 | undefined { + const _3: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_3 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _3; + const buf: Uint8Array = rt.bytes(8); + const _8: rt.Result = tryCopyToSlice$bytes_Buf(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_8.ok) { + return rt.i64FromBeBytes(buf); + } + Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets a signed n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int_le(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int_le(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetIntLe$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.i64 | undefined { + const buf: Uint8Array = rt.bytes(8); + const _4: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_4 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _11: rt.Result = tryCopyToSlice$bytes_Buf(self, _4); + if (_11.ok) { + return rt.i64FromBeBytes(buf.slice().reverse()); + } + Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets a signed n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int_ne(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03", + * false => b"\x03\x02\x01", + * }; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int_ne(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetIntNe$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.i64 | undefined { + return tryGetIntLe$bytes_Buf(self, nbytes); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\x99\x99\x9A hello"[..]; + * assert_eq!(1.2f32, buf.get_f32()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32$bytes_Buf(self: Pieces): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, false, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32_le()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32Le$bytes_Buf(self: Pieces): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\x99\x99\x9A hello", + * false => b"\x9A\x99\x99\x3F hello", + * }; + * assert_eq!(1.2f32, buf.get_f32_ne()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32_ne()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32Ne$bytes_Buf(self: Pieces): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64$bytes_Buf(self: Pieces): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, false, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello"[..]; + * assert_eq!(1.2f64, buf.get_f64_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64_le()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64Le$bytes_Buf(self: Pieces): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello", + * false => b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello", + * }; + * assert_eq!(1.2f64, buf.get_f64_ne()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64_ne()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64Ne$bytes_Buf(self: Pieces): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Advance the internal cursor of the Buf + * + * The next call to `chunk()` will return a slice starting `cnt` bytes + * further into the underlying buffer. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.chunk(), &b"hello world"[..]); + * + * buf.advance(6); + * + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` + * + * # Panics + * + * This function **may** panic if `cnt > self.remaining()`. + * + * # Implementer notes + * + * It is recommended for implementations of `advance` to panic if `cnt > + * self.remaining()`. If the implementation does not panic, the call must + * behave as if `cnt == self.remaining()`. + * + * A call with `cnt == 0` should never panic and be a no-op. + */ +export function advance$bytes_Buf_mut(self: rt.Place, cnt: rt.usize): void { + advance$bytes_Buf(self.v, cnt); +} + +/** + * Returns a slice starting at the current position and of length between 0 + * and `Buf::remaining()`. Note that this *can* return a shorter slice (this + * allows non-continuous internal representation). + * + * This is a lower level function. Most operations are done with other + * functions. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.chunk(), &b"hello world"[..]); + * + * buf.advance(6); + * + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` + * + * # Implementer notes + * + * This function should never panic. `chunk()` should return an empty + * slice **if and only if** `remaining()` returns 0. In other words, + * `chunk()` returning an empty slice implies that `remaining()` will + * return 0 and `remaining()` returning 0 implies that `chunk()` will + * return an empty slice. + */ +export function chunk$bytes_Buf_mut(self: Pieces): rt.ByteSlice { + return chunk$bytes_Buf(self); +} + +/** + * Consumes `len` bytes inside self and returns new instance of `Bytes` + * with this data. + * + * This function may be optimized by the underlying type to avoid actual + * copies. For example, `Bytes` implementation will do a shallow copy + * (ref-count increment). + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let bytes = (&b"hello world"[..]).copy_to_bytes(5); + * assert_eq!(&bytes[..], &b"hello"[..]); + * ``` + * + * # Panics + * + * This function panics if `len > self.remaining()`. + */ +export function copyToBytes$bytes_Buf_mut(self: rt.Place, len: rt.usize): rt.ByteSlice { + return copyToBytes$bytes_Buf(self.v, len); +} + +/** + * Copies bytes from `self` into `dst`. + * + * The cursor is advanced by the number of bytes copied. `self` must have + * enough remaining bytes to fill `dst`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 5]; + * + * buf.copy_to_slice(&mut dst); + * assert_eq!(&b"hello"[..], &dst); + * assert_eq!(6, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `self.remaining() < dst.len()`. + */ +export function copyToSlice$bytes_Buf_mut(self: rt.Place, dst: rt.ByteSlice): void { + copyToSlice$bytes_Buf(self.v, dst); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32Le$bytes_Buf_mut(self: rt.Place): rt.f32 { + return getF32Le$bytes_Buf(self.v); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64$bytes_Buf_mut(self: rt.Place): rt.f64 { + return getF64$bytes_Buf(self.v); +} + +/** + * Gets a signed 128 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 16. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello"[..]; + * assert_eq!(0x01020304050607080910111213141516, buf.get_i128()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getI128$bytes_Buf_mut(self: rt.Place): rt.i128 { + return rt.bufGet(self.v, 16, false, rt.i128FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); +} + /** - * Returns true if there are any more bytes to consume + * Gets a signed 16 bit integer from `self` in little-endian byte order. * - * This is equivalent to `self.remaining() != 0`. + * The current position is advanced by 2. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"a"[..]; + * let mut buf = &b"\x09\x08 hello"[..]; + * assert_eq!(0x0809, buf.get_i16_le()); + * ``` * - * assert!(buf.has_remaining()); + * # Panics * - * buf.get_u8(); + * This function panics if there is not enough remaining data in `self`. + */ +export function getI16Le$bytes_Buf_mut(self: rt.Place): rt.i16 { + return rt.bufGet(self.v, 2, true, rt.i16FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); +} + +/** + * Gets a signed 32 bit integer from `self` in big-endian byte order. * - * assert!(!buf.has_remaining()); + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08\x09\xA0\xA1 hello"[..]; + * assert_eq!(0x0809A0A1, buf.get_i32()); * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. */ -export function hasRemaining$bytes_Buf(self: Pieces): boolean { - return remaining$bytes_Buf(self) > 0; +export function getI32$bytes_Buf_mut(self: rt.Place): rt.i32 { + return rt.bufGet(self.v, 4, false, rt.i32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); } /** - * Copies bytes from `self` into `dst`. + * Gets a signed 64 bit integer from `self` in little-endian byte order. * - * The cursor is advanced by the number of bytes copied. `self` must have - * enough remaining bytes to fill `dst`. + * The current position is advanced by 8. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"hello world"[..]; - * let mut dst = [0; 5]; - * - * buf.copy_to_slice(&mut dst); - * assert_eq!(&b"hello"[..], &dst); - * assert_eq!(6, buf.remaining()); + * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; + * assert_eq!(0x0102030405060708, buf.get_i64_le()); * ``` * * # Panics * - * This function panics if `self.remaining() < dst.len()`. + * This function panics if there is not enough remaining data in `self`. */ -export function copyToSlice$bytes_Buf(self: Pieces, dst: rt.ByteSlice): void { - result_unwrapOrElse$0s2lrc9(tryCopyToSlice$bytes_Buf(self, dst), (error: TryGetError.TryGetError): undefined => { - panicAdvance(error); - }); +export function getI64Le$bytes_Buf_mut(self: rt.Place): rt.i64 { + return rt.bufGet(self.v, 8, true, rt.i64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); } /** - * Gets an unsigned 8 bit integer from `self`. + * Gets a signed 8 bit integer from `self`. * * The current position is advanced by 1. * @@ -238,190 +1479,126 @@ export function copyToSlice$bytes_Buf(self: Pieces, dst: rt.ByteSlice): void { * use bytes::Buf; * * let mut buf = &b"\x08 hello"[..]; - * assert_eq!(8, buf.get_u8()); + * assert_eq!(8, buf.get_i8()); * ``` * * # Panics * * This function panics if there is no more remaining data in `self`. */ -export function getU8$bytes_Buf(self: Pieces): rt.u8 { - if (!(remaining$bytes_Buf_mut(self) < 1)) { - const _7: rt.ByteSlice = chunk$bytes_Buf_mut(self); - rt.idx(_7, 0); - const ret: rt.u8 = _7.data[_7.start]; - advance$bytes_Buf(self, 1); - return ret; - } - panicAdvance({ requested: 1, available: 0 }); +export function getI8$bytes_Buf_mut(self: rt.Place): rt.i8 { + return getI8$bytes_Buf(self.v); } /** - * Copies bytes from `self` into `dst`. - * - * The cursor is advanced by the number of bytes copied. `self` must have - * enough remaining bytes to fill `dst`. + * Gets a signed n-byte integer from `self` in little-endian byte order. * - * Returns `Err(TryGetError)` when there are not enough - * remaining bytes to read the value. + * The current position is advanced by `nbytes`. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"hello world"[..]; - * let mut dst = [0; 5]; - * - * assert_eq!(Ok(()), buf.try_copy_to_slice(&mut dst)); - * assert_eq!(&b"hello"[..], &dst); - * assert_eq!(6, buf.remaining()); - * ``` - * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(0x010203, buf.get_int_le(3)); * ``` - * use bytes::{Buf, TryGetError}; * - * let mut buf = &b"hello world"[..]; - * let mut dst = [0; 12]; + * # Panics * - * assert_eq!(Err(TryGetError{requested: 12, available: 11}), buf.try_copy_to_slice(&mut dst)); - * assert_eq!(11, buf.remaining()); - * ``` + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. */ -export function tryCopyToSlice$bytes_Buf(self: Pieces, dst: rt.ByteSlice): rt.Result { - if (!(remaining$bytes_Buf_mut(self) < dst.length)) { - while (!(dst.length === 0)) { - const src: rt.ByteSlice = chunk$bytes_Buf_mut(self); - const cnt: rt.usize = rt.min(src.length, dst.length); - rt.byteSliceCopyFromSlice(rt.byteSliceRange(dst, 0, cnt), rt.byteSliceRange(src, 0, cnt)); - dst = rt.byteSliceRange(dst, cnt); - advance$bytes_Buf(self, cnt); - } - return rt.OK; - } - return rt.Err({ requested: dst.length, available: remaining$bytes_Buf_mut(self) }); +export function getIntLe$bytes_Buf_mut(self: rt.Place, nbytes: rt.usize): rt.i64 { + return getIntLe$bytes_Buf(self.v, nbytes); } /** - * Advance the internal cursor of the Buf + * Gets an unsigned 128 bit integer from `self` in little-endian byte order. * - * The next call to `chunk()` will return a slice starting `cnt` bytes - * further into the underlying buffer. + * The current position is advanced by 16. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"hello world"[..]; - * - * assert_eq!(buf.chunk(), &b"hello world"[..]); - * - * buf.advance(6); - * - * assert_eq!(buf.chunk(), &b"world"[..]); + * let mut buf = &b"\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; + * assert_eq!(0x01020304050607080910111213141516, buf.get_u128_le()); * ``` * * # Panics * - * This function **may** panic if `cnt > self.remaining()`. - * - * # Implementer notes - * - * It is recommended for implementations of `advance` to panic if `cnt > - * self.remaining()`. If the implementation does not panic, the call must - * behave as if `cnt == self.remaining()`. - * - * A call with `cnt == 0` should never panic and be a no-op. + * This function panics if there is not enough remaining data in `self`. */ -export function advance$bytes_Buf_mut(self: rt.Place, cnt: rt.usize): void { - advance$bytes_Buf(self.v, cnt); +export function getU128Le$bytes_Buf_mut(self: rt.Place): rt.u128 { + return rt.bufGet(self.v, 16, true, rt.u128FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); } /** - * Returns a slice starting at the current position and of length between 0 - * and `Buf::remaining()`. Note that this *can* return a shorter slice (this - * allows non-continuous internal representation). + * Gets an unsigned 16 bit integer from `self` in big-endian byte order. * - * This is a lower level function. Most operations are done with other - * functions. + * The current position is advanced by 2. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"hello world"[..]; - * - * assert_eq!(buf.chunk(), &b"hello world"[..]); - * - * buf.advance(6); - * - * assert_eq!(buf.chunk(), &b"world"[..]); + * let mut buf = &b"\x08\x09 hello"[..]; + * assert_eq!(0x0809, buf.get_u16()); * ``` * - * # Implementer notes + * # Panics * - * This function should never panic. `chunk()` should return an empty - * slice **if and only if** `remaining()` returns 0. In other words, - * `chunk()` returning an empty slice implies that `remaining()` will - * return 0 and `remaining()` returning 0 implies that `chunk()` will - * return an empty slice. + * This function panics if there is not enough remaining data in `self`. */ -export function chunk$bytes_Buf_mut(self: Pieces): rt.ByteSlice { - return chunk$bytes_Buf(self); +export function getU16$bytes_Buf_mut(self: rt.Place): rt.u16 { + return rt.bufGet(self.v, 2, false, rt.u16FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); } /** - * Consumes `len` bytes inside self and returns new instance of `Bytes` - * with this data. + * Gets an unsigned 32 bit integer from `self` in the little-endian byte order. * - * This function may be optimized by the underlying type to avoid actual - * copies. For example, `Bytes` implementation will do a shallow copy - * (ref-count increment). + * The current position is advanced by 4. * * # Examples * * ``` * use bytes::Buf; * - * let bytes = (&b"hello world"[..]).copy_to_bytes(5); - * assert_eq!(&bytes[..], &b"hello"[..]); + * let mut buf = &b"\xA1\xA0\x09\x08 hello"[..]; + * assert_eq!(0x0809A0A1, buf.get_u32_le()); * ``` * * # Panics * - * This function panics if `len > self.remaining()`. + * This function panics if there is not enough remaining data in `self`. */ -export function copyToBytes$bytes_Buf_mut(self: rt.Place, len: rt.usize): rt.ByteSlice { - return copyToBytes$bytes_Buf(self.v, len); +export function getU32Le$bytes_Buf_mut(self: rt.Place): rt.u32 { + return rt.bufGet(self.v, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); } /** - * Copies bytes from `self` into `dst`. + * Gets an unsigned 64 bit integer from `self` in big-endian byte order. * - * The cursor is advanced by the number of bytes copied. `self` must have - * enough remaining bytes to fill `dst`. + * The current position is advanced by 8. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"hello world"[..]; - * let mut dst = [0; 5]; - * - * buf.copy_to_slice(&mut dst); - * assert_eq!(&b"hello"[..], &dst); - * assert_eq!(6, buf.remaining()); + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08 hello"[..]; + * assert_eq!(0x0102030405060708, buf.get_u64()); * ``` * * # Panics * - * This function panics if `self.remaining() < dst.len()`. + * This function panics if there is not enough remaining data in `self`. */ -export function copyToSlice$bytes_Buf_mut(self: rt.Place, dst: rt.ByteSlice): void { - copyToSlice$bytes_Buf(self.v, dst); +export function getU64$bytes_Buf_mut(self: rt.Place): rt.u64 { + return rt.bufGet(self.v, 8, false, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); } /** @@ -446,6 +1623,29 @@ export function getU8$bytes_Buf_mut(self: rt.Place): rt.u8 { return getU8$bytes_Buf(self.v); } +/** + * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(0x010203, buf.get_uint(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUint$bytes_Buf_mut(self: rt.Place, nbytes: rt.usize): rt.u64 { + return getUint$bytes_Buf(self.v, nbytes); +} + /** * Returns true if there are any more bytes to consume * @@ -554,6 +1754,144 @@ export function remaining$bytes_Buf_mut_mut(self: rt.Place): rt.usize { return remaining$bytes_Buf_mut(self.v); } +/** + * Gets a signed 64 bit integer from `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x0102030405060708_i64), buf.try_get_i64_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_i64_le()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetI64Le$bytes_Buf_mut(self: rt.Place): rt.i64 | undefined { + const _0: rt.Result = rt.bufTryGet(self.v, 8, true, rt.i64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); + if (!_0.ok) { + Counted.tryGetIntOut$bytes_Buf.err = _0.error; + return undefined; + } + return _0.value; +} + +/** + * Gets an unsigned 128 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 16. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello"[..]; + * assert_eq!(Ok(0x01020304050607080910111213141516_u128), buf.try_get_u128()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15"[..]; + * assert_eq!(Err(TryGetError{requested: 16, available: 15}), buf.try_get_u128()); + * assert_eq!(15, buf.remaining()); + * ``` + */ +export function tryGetU128$bytes_Buf_mut(self: rt.Place): rt.u128 | undefined { + const _0: rt.Result = rt.bufTryGet(self.v, 16, false, rt.u128FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); + if (!_0.ok) { + tryGetU128Out$bytes_Buf_mut.err = _0.error; + return undefined; + } + return _0.value; +} + +export const tryGetU128Out$bytes_Buf_mut: { err: unknown } = { err: undefined }; + +/** + * Gets an unsigned 16 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 2. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08\x09 hello"[..]; + * assert_eq!(Ok(0x0809_u16), buf.try_get_u16()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x08"[..]; + * assert_eq!(Err(TryGetError{requested: 2, available: 1}), buf.try_get_u16()); + * assert_eq!(1, buf.remaining()); + * ``` + */ +export function tryGetU16$bytes_Buf_mut(self: rt.Place): rt.u16 | undefined { + const _0: rt.Result = rt.bufTryGet(self.v, 2, false, rt.u16FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); + if (!_0.ok) { + tryGetU16Out$bytes_Buf_mut.err = _0.error; + return undefined; + } + return _0.value; +} + +export const tryGetU16Out$bytes_Buf_mut: { err: unknown } = { err: undefined }; + +/** + * Gets an unsigned 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_u8), buf.try_get_u8()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_u8()); + * ``` + */ +export function tryGetU8$bytes_Buf_mut(self: rt.Place): rt.u8 | undefined { + return tryGetU8$bytes_Buf(self.v); +} + export { new_ as new }; //# sourceMappingURL=buf.Pieces.ts.map diff --git a/ts/fixtures/stock/expected/buf.Provided.ts b/ts/fixtures/stock/expected/buf.Provided.ts index 8c9064e8c..f8d7cb186 100644 --- a/ts/fixtures/stock/expected/buf.Provided.ts +++ b/ts/fixtures/stock/expected/buf.Provided.ts @@ -1,10 +1,12 @@ // Generated by rust2-ts. Do not edit. import * as rt from "./rt.ts"; +import * as Counted from "./buf.Counted.ts"; import * as Pieces from "./buf.Pieces.ts"; -import { panicAdvance } from "./bytes.ts"; +import { panicAdvance, panicDoesNotFit } from "./bytes.ts"; +import { signExtend } from "./bytes/buf/buf_impl.ts"; import type * as TryGetError from "./bytes.TryGetError.ts"; -import { unwrapOrElse$0s2lrc9 as result_unwrapOrElse$0s2lrc9 } from "./core/result.ts"; +import { unwrapOrElse$1wp5sd9 as result_unwrapOrElse$1wp5sd9, unwrapOrElse$0s2lrc9 as result_unwrapOrElse$0s2lrc9 } from "./core/result.ts"; /** * A buffer in pieces with only `Buf`'s required methods, so `copy_to_bytes` is the @@ -196,6 +198,352 @@ export function getU8$bytes_Buf(self: Provided): rt.u8 { panicAdvance({ requested: 1, available: 0 }); } +/** + * Gets a signed 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(8, buf.get_i8()); + * ``` + * + * # Panics + * + * This function panics if there is no more remaining data in `self`. + */ +export function getI8$bytes_Buf(self: Provided): rt.i8 { + if (!(remaining$bytes_Buf_mut(self) < 1)) { + const _8: rt.ByteSlice = chunk$bytes_Buf_mut(self); + rt.idx(_8, 0); + const ret: rt.i8 = (_8.data[_8.start] << 24) >> 24; + advance$bytes_Buf(self, 1); + return ret; + } + panicAdvance({ requested: 1, available: 0 }); +} + +/** + * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(0x010203, buf.get_uint(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUint$bytes_Buf(self: Provided, nbytes: rt.usize): rt.u64 { + return result_unwrapOrElse$1wp5sd9(((): rt.Result => { + const _2: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_2 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _2; + const buf: Uint8Array = rt.bytes(8); + const _9: rt.Result = tryCopyToSlice$bytes_Buf(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_9.ok) { + return rt.Ok(rt.u64FromBeBytes(buf)); + } + return _9; + } + })(), (error: TryGetError.TryGetError): rt.u64 => { + panicAdvance(error); + }); +} + +/** + * Gets an unsigned n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(0x010203, buf.get_uint_le(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUintLe$bytes_Buf(self: Provided, nbytes: rt.usize): rt.u64 { + return result_unwrapOrElse$1wp5sd9(((): rt.Result => { + const buf: Uint8Array = rt.bytes(8); + const _32: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_32 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _12: rt.Result = tryCopyToSlice$bytes_Buf(self, _32); + if (_12.ok) { + return rt.Ok(rt.u64FromBeBytes(buf.slice().reverse())); + } + return _12; + } + })(), (error: TryGetError.TryGetError): rt.u64 => { + panicAdvance(error); + }); +} + +/** + * Gets an unsigned n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(0x010203, buf.get_uint_ne(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUintNe$bytes_Buf(self: Provided, nbytes: rt.usize): rt.u64 { + return getUintLe$bytes_Buf(self, nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(0x010203, buf.get_int(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getInt$bytes_Buf(self: Provided, nbytes: rt.usize): rt.i64 { + return signExtend(getUint$bytes_Buf(self, nbytes), nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(0x010203, buf.get_int_le(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getIntLe$bytes_Buf(self: Provided, nbytes: rt.usize): rt.i64 { + return signExtend(getUintLe$bytes_Buf(self, nbytes), nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(0x010203, buf.get_int_ne(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getIntNe$bytes_Buf(self: Provided, nbytes: rt.usize): rt.i64 { + return getIntLe$bytes_Buf(self, nbytes); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\x99\x99\x9A hello"[..]; + * assert_eq!(1.2f32, buf.get_f32()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32$bytes_Buf(self: Provided): rt.f32 { + return rt.f32FromBits(rt.bufGet(self, 4, false, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Provided, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Provided, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32Le$bytes_Buf(self: Provided): rt.f32 { + return rt.f32FromBits(rt.bufGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Provided, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Provided, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\x99\x99\x9A hello", + * false => b"\x9A\x99\x99\x3F hello", + * }; + * assert_eq!(1.2f32, buf.get_f32_ne()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32Ne$bytes_Buf(self: Provided): rt.f32 { + return rt.f32FromBits(rt.bufGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Provided, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Provided, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64$bytes_Buf(self: Provided): rt.f64 { + return rt.f64FromBits(rt.bufGet(self, 8, false, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Provided, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Provided, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello"[..]; + * assert_eq!(1.2f64, buf.get_f64_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64Le$bytes_Buf(self: Provided): rt.f64 { + return rt.f64FromBits(rt.bufGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Provided, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Provided, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello", + * false => b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello", + * }; + * assert_eq!(1.2f64, buf.get_f64_ne()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64Ne$bytes_Buf(self: Provided): rt.f64 { + return rt.f64FromBits(rt.bufGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Provided, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Provided, a1: rt.ByteSlice) => undefined)); +} + /** * Copies bytes from `self` into `dst`. * @@ -242,6 +590,564 @@ export function tryCopyToSlice$bytes_Buf(self: Provided, dst: rt.ByteSlice): rt. return rt.Err({ requested: dst.length, available: remaining$bytes_Buf_mut(self) }); } +/** + * Gets an unsigned 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_u8), buf.try_get_u8()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_u8()); + * ``` + */ +export function tryGetU8$bytes_Buf(self: Provided): rt.u8 | undefined { + if (!(remaining$bytes_Buf_mut(self) < 1)) { + const _9: rt.ByteSlice = chunk$bytes_Buf_mut(self); + rt.idx(_9, 0); + const ret: rt.u8 = _9.data[_9.start]; + advance$bytes_Buf(self, 1); + return ret; + } + Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut(self) }; + return undefined; +} + +/** + * Gets a signed 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_i8), buf.try_get_i8()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_i8()); + * ``` + */ +export function tryGetI8$bytes_Buf(self: Provided): rt.i8 | undefined { + if (!(remaining$bytes_Buf_mut(self) < 1)) { + const _10: rt.ByteSlice = chunk$bytes_Buf_mut(self); + rt.idx(_10, 0); + const ret: rt.i8 = (_10.data[_10.start] << 24) >> 24; + advance$bytes_Buf(self, 1); + return ret; + } + Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut(self) }; + return undefined; +} + +/** + * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` > 8. + */ +export function tryGetUint$bytes_Buf(self: Provided, nbytes: rt.usize): rt.u64 | undefined { + const _3: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_3 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _3; + const buf: Uint8Array = rt.bytes(8); + const _8: rt.Result = tryCopyToSlice$bytes_Buf(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_8.ok) { + return rt.u64FromBeBytes(buf); + } + Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets an unsigned n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint_le(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint_le(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` > 8. + */ +export function tryGetUintLe$bytes_Buf(self: Provided, nbytes: rt.usize): rt.u64 | undefined { + const buf: Uint8Array = rt.bytes(8); + const _4: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_4 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _11: rt.Result = tryCopyToSlice$bytes_Buf(self, _4); + if (_11.ok) { + return rt.u64FromBeBytes(buf.slice().reverse()); + } + Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets an unsigned n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint_ne(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03", + * false => b"\x03\x02\x01", + * }; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint_ne(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetUintNe$bytes_Buf(self: Provided, nbytes: rt.usize): rt.u64 | undefined { + return tryGetUintLe$bytes_Buf(self, nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetInt$bytes_Buf(self: Provided, nbytes: rt.usize): rt.i64 | undefined { + const _3: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_3 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _3; + const buf: Uint8Array = rt.bytes(8); + const _8: rt.Result = tryCopyToSlice$bytes_Buf(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_8.ok) { + return rt.i64FromBeBytes(buf); + } + Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets a signed n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int_le(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int_le(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetIntLe$bytes_Buf(self: Provided, nbytes: rt.usize): rt.i64 | undefined { + const buf: Uint8Array = rt.bytes(8); + const _4: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_4 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _11: rt.Result = tryCopyToSlice$bytes_Buf(self, _4); + if (_11.ok) { + return rt.i64FromBeBytes(buf.slice().reverse()); + } + Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets a signed n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int_ne(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03", + * false => b"\x03\x02\x01", + * }; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int_ne(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetIntNe$bytes_Buf(self: Provided, nbytes: rt.usize): rt.i64 | undefined { + return tryGetIntLe$bytes_Buf(self, nbytes); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\x99\x99\x9A hello"[..]; + * assert_eq!(1.2f32, buf.get_f32()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32$bytes_Buf(self: Provided): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, false, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Provided, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Provided, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32_le()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32Le$bytes_Buf(self: Provided): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Provided, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Provided, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\x99\x99\x9A hello", + * false => b"\x9A\x99\x99\x3F hello", + * }; + * assert_eq!(1.2f32, buf.get_f32_ne()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32_ne()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32Ne$bytes_Buf(self: Provided): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Provided, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Provided, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64$bytes_Buf(self: Provided): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, false, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Provided, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Provided, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello"[..]; + * assert_eq!(1.2f64, buf.get_f64_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64_le()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64Le$bytes_Buf(self: Provided): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Provided, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Provided, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello", + * false => b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello", + * }; + * assert_eq!(1.2f64, buf.get_f64_ne()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64_ne()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64Ne$bytes_Buf(self: Provided): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Provided, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Provided, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + /** * Returns a slice starting at the current position and of length between 0 * and `Buf::remaining()`. Note that this *can* return a shorter slice (this diff --git a/ts/fixtures/stock/expected/buf.ts b/ts/fixtures/stock/expected/buf.ts index ad750ee93..58877d4bf 100644 --- a/ts/fixtures/stock/expected/buf.ts +++ b/ts/fixtures/stock/expected/buf.ts @@ -1,12 +1,18 @@ // Generated by rust2-ts. Do not edit. import * as rt from "./rt.ts"; +import * as Counted from "./buf.Counted.ts"; +import * as Leased from "./buf.Leased.ts"; import * as Ops from "./buf.Ops.ts"; import * as Pieces from "./buf.Pieces.ts"; import * as Provided from "./buf.Provided.ts"; -import { advance$bytes_Buf_mut_bytes_Bytes, advance$bytes_Buf_mut_ref_slice_u8, copyToBytes$bytes_Buf_mut_bytes_Bytes, copyToBytes$bytes_Buf_mut_ref_slice_u8, copyToSlice$bytes_Buf_mut_bytes_Bytes, copyToSlice$bytes_Buf_mut_ref_slice_u8, getF32Le$bytes_Buf_mut_bytes_Bytes, getF32Le$bytes_Buf_mut_ref_slice_u8, getF64$bytes_Buf_mut_bytes_Bytes, getF64$bytes_Buf_mut_ref_slice_u8, getI128$bytes_Buf_mut_bytes_Bytes, getI128$bytes_Buf_mut_ref_slice_u8, getI16Le$bytes_Buf_mut_bytes_Bytes, getI16Le$bytes_Buf_mut_ref_slice_u8, getI32$bytes_Buf_mut_bytes_Bytes, getI32$bytes_Buf_mut_ref_slice_u8, getI64Le$bytes_Buf_mut_bytes_Bytes, getI64Le$bytes_Buf_mut_ref_slice_u8, getI8$bytes_Buf_mut_bytes_Bytes, getI8$bytes_Buf_mut_ref_slice_u8, getIntLe$bytes_Buf_mut_bytes_Bytes, getIntLe$bytes_Buf_mut_ref_slice_u8, getU128Le$bytes_Buf_mut_bytes_Bytes, getU128Le$bytes_Buf_mut_ref_slice_u8, getU16$bytes_Buf_mut_bytes_Bytes, getU16$bytes_Buf_mut_ref_slice_u8, getU32Le$bytes_Buf_mut_bytes_Bytes, getU32Le$bytes_Buf_mut_ref_slice_u8, getU64$bytes_Buf_mut_bytes_Bytes, getU64$bytes_Buf_mut_ref_slice_u8, getU8$bytes_Buf_mut_bytes_Bytes, getU8$bytes_Buf_mut_ref_slice_u8, getUint$bytes_Buf_mut_bytes_Bytes, getUint$bytes_Buf_mut_ref_slice_u8, hasRemaining$bytes_Buf_mut_bytes_Bytes, hasRemaining$bytes_Buf_mut_bytes_BytesMut, hasRemaining$bytes_Buf_mut_mut_bytes_Bytes, hasRemaining$bytes_Buf_mut_mut_ref_slice_u8, hasRemaining$bytes_Buf_mut_ref_slice_u8, remaining$bytes_Buf_mut_bytes_Bytes, remaining$bytes_Buf_mut_bytes_BytesMut, remaining$bytes_Buf_mut_mut_bytes_Bytes, remaining$bytes_Buf_mut_mut_ref_slice_u8, remaining$bytes_Buf_mut_ref_slice_u8 } from "./bytes/buf/buf_impl.ts"; +import { tryGetU8$bytes_Buf_bytes_Bytes, tryGetU8$bytes_Buf_bytes_BytesMut, tryGetU8$bytes_Buf_ref_slice_u8, take$bytes_Buf_bytes_Bytes as buf_impl_take$bytes_Buf_bytes_Bytes, advance$bytes_Buf_mut_bytes_Bytes, advance$bytes_Buf_mut_dyn_bytes_Buf, advance$bytes_Buf_mut_ref_slice_u8, copyToBytes$bytes_Buf_mut_bytes_Bytes, copyToBytes$bytes_Buf_mut_dyn_bytes_Buf, copyToBytes$bytes_Buf_mut_ref_slice_u8, copyToSlice$bytes_Buf_mut_bytes_Bytes, copyToSlice$bytes_Buf_mut_dyn_bytes_Buf, copyToSlice$bytes_Buf_mut_ref_slice_u8, getF32Le$bytes_Buf_mut_bytes_Bytes, getF32Le$bytes_Buf_mut_dyn_bytes_Buf, getF32Le$bytes_Buf_mut_ref_slice_u8, getF64$bytes_Buf_mut_bytes_Bytes, getF64$bytes_Buf_mut_dyn_bytes_Buf, getF64$bytes_Buf_mut_ref_slice_u8, getI128$bytes_Buf_mut_bytes_Bytes, getI128$bytes_Buf_mut_dyn_bytes_Buf, getI128$bytes_Buf_mut_ref_slice_u8, getI16Le$bytes_Buf_mut_bytes_Bytes, getI16Le$bytes_Buf_mut_dyn_bytes_Buf, getI16Le$bytes_Buf_mut_ref_slice_u8, getI32$bytes_Buf_mut_bytes_Bytes, getI32$bytes_Buf_mut_dyn_bytes_Buf, getI32$bytes_Buf_mut_ref_slice_u8, getI64Le$bytes_Buf_mut_bytes_Bytes, getI64Le$bytes_Buf_mut_dyn_bytes_Buf, getI64Le$bytes_Buf_mut_ref_slice_u8, getI8$bytes_Buf_mut_bytes_Bytes, getI8$bytes_Buf_mut_dyn_bytes_Buf, getI8$bytes_Buf_mut_ref_slice_u8, getIntLe$bytes_Buf_mut_bytes_Bytes, getIntLe$bytes_Buf_mut_dyn_bytes_Buf, getIntLe$bytes_Buf_mut_ref_slice_u8, getU128Le$bytes_Buf_mut_bytes_Bytes, getU128Le$bytes_Buf_mut_dyn_bytes_Buf, getU128Le$bytes_Buf_mut_ref_slice_u8, getU16$bytes_Buf_mut_bytes_Bytes, getU16$bytes_Buf_mut_dyn_bytes_Buf, getU16$bytes_Buf_mut_ref_slice_u8, getU32Le$bytes_Buf_mut_bytes_Bytes, getU32Le$bytes_Buf_mut_dyn_bytes_Buf, getU32Le$bytes_Buf_mut_ref_slice_u8, getU64$bytes_Buf_mut_bytes_Bytes, getU64$bytes_Buf_mut_dyn_bytes_Buf, getU64$bytes_Buf_mut_ref_slice_u8, getU8$bytes_Buf_mut_bytes_Bytes, getU8$bytes_Buf_mut_dyn_bytes_Buf, getU8$bytes_Buf_mut_ref_slice_u8, getUint$bytes_Buf_mut_bytes_Bytes, getUint$bytes_Buf_mut_dyn_bytes_Buf, getUint$bytes_Buf_mut_ref_slice_u8, hasRemaining$bytes_Buf_mut_boxed_Box_dyn_bytes_Buf, hasRemaining$bytes_Buf_mut_bytes_Bytes, hasRemaining$bytes_Buf_mut_bytes_BytesMut, hasRemaining$bytes_Buf_mut_dyn_buf_Leased, hasRemaining$bytes_Buf_mut_dyn_bytes_Buf, hasRemaining$bytes_Buf_mut_mut_bytes_Bytes, hasRemaining$bytes_Buf_mut_mut_dyn_bytes_Buf, hasRemaining$bytes_Buf_mut_mut_ref_slice_u8, hasRemaining$bytes_Buf_mut_ref_slice_u8, remaining$bytes_Buf_mut_boxed_Box_dyn_bytes_Buf, remaining$bytes_Buf_mut_bytes_Bytes, remaining$bytes_Buf_mut_bytes_BytesMut, remaining$bytes_Buf_mut_dyn_buf_Leased, remaining$bytes_Buf_mut_dyn_bytes_Buf, remaining$bytes_Buf_mut_mut_bytes_Bytes, remaining$bytes_Buf_mut_mut_dyn_bytes_Buf, remaining$bytes_Buf_mut_mut_ref_slice_u8, remaining$bytes_Buf_mut_ref_slice_u8, tryGetI64Le$bytes_Buf_mut_bytes_Bytes, tryGetI64Le$bytes_Buf_mut_dyn_bytes_Buf, tryGetI64Le$bytes_Buf_mut_ref_slice_u8, tryGetU128$bytes_Buf_mut_bytes_Bytes, tryGetU128$bytes_Buf_mut_dyn_bytes_Buf, tryGetU128$bytes_Buf_mut_ref_slice_u8, tryGetU16$bytes_Buf_mut_bytes_Bytes, tryGetU16$bytes_Buf_mut_dyn_bytes_Buf, tryGetU16$bytes_Buf_mut_ref_slice_u8, tryGetU8$bytes_Buf_mut_bytes_Bytes, tryGetU8$bytes_Buf_mut_dyn_bytes_Buf, tryGetU8$bytes_Buf_mut_ref_slice_u8, advance$bytes_Buf_boxed_Box_dyn_bytes_Buf, copyToBytes$bytes_Buf_boxed_Box_dyn_bytes_Buf, copyToSlice$bytes_Buf_boxed_Box_dyn_bytes_Buf, getF32Le$bytes_Buf_boxed_Box_dyn_bytes_Buf, getF64$bytes_Buf_boxed_Box_dyn_bytes_Buf, getI128$bytes_Buf_boxed_Box_dyn_bytes_Buf, getI16Le$bytes_Buf_boxed_Box_dyn_bytes_Buf, getI32$bytes_Buf_boxed_Box_dyn_bytes_Buf, getI64Le$bytes_Buf_boxed_Box_dyn_bytes_Buf, getI8$bytes_Buf_boxed_Box_dyn_bytes_Buf, getIntLe$bytes_Buf_boxed_Box_dyn_bytes_Buf, getU128Le$bytes_Buf_boxed_Box_dyn_bytes_Buf, getU16$bytes_Buf_boxed_Box_dyn_bytes_Buf, getU32Le$bytes_Buf_boxed_Box_dyn_bytes_Buf, getU64$bytes_Buf_boxed_Box_dyn_bytes_Buf, getU8$bytes_Buf_boxed_Box_dyn_bytes_Buf, getUint$bytes_Buf_boxed_Box_dyn_bytes_Buf, tryGetI64Le$bytes_Buf_boxed_Box_dyn_bytes_Buf, tryGetU128$bytes_Buf_boxed_Box_dyn_bytes_Buf, tryGetU16$bytes_Buf_boxed_Box_dyn_bytes_Buf, tryGetU8$bytes_Buf_boxed_Box_dyn_bytes_Buf } from "./bytes/buf/buf_impl.ts"; +import * as Buf from "./bytes/buf/buf_impl.Buf.ts"; import { putI16Le$bytes_BufMut_mut_Vec_u8, putI16Le$bytes_BufMut_mut_bytes_BytesMut, putI32Le$bytes_BufMut_mut_Vec_u8, putI32Le$bytes_BufMut_mut_bytes_BytesMut, putI64$bytes_BufMut_mut_Vec_u8, putI64$bytes_BufMut_mut_bytes_BytesMut, putI8$bytes_BufMut_mut_Vec_u8, putI8$bytes_BufMut_mut_bytes_BytesMut, putSlice$bytes_BufMut_mut_Vec_u8, putSlice$bytes_BufMut_mut_bytes_BytesMut, putU16$bytes_BufMut_mut_Vec_u8, putU16$bytes_BufMut_mut_bytes_BytesMut, putU32$bytes_BufMut_mut_Vec_u8, putU32$bytes_BufMut_mut_bytes_BytesMut, putU64Le$bytes_BufMut_mut_Vec_u8, putU64Le$bytes_BufMut_mut_bytes_BytesMut, putU8$bytes_BufMut_mut_Vec_u8, putU8$bytes_BufMut_mut_bytes_BytesMut, remainingMut$bytes_BufMut_mut_Vec_u8, remainingMut$bytes_BufMut_mut_boxed_Box_Vec_u8, remainingMut$bytes_BufMut_mut_boxed_Box_bytes_BytesMut, remainingMut$bytes_BufMut_mut_bytes_BytesMut, remainingMut$bytes_BufMut_mut_mut_Vec_u8, remainingMut$bytes_BufMut_mut_mut_bytes_BytesMut, putI16Le$bytes_BufMut_boxed_Box_Vec_u8, putI16Le$bytes_BufMut_boxed_Box_bytes_BytesMut, putI32Le$bytes_BufMut_boxed_Box_Vec_u8, putI32Le$bytes_BufMut_boxed_Box_bytes_BytesMut, putI64$bytes_BufMut_boxed_Box_Vec_u8, putI64$bytes_BufMut_boxed_Box_bytes_BytesMut, putI8$bytes_BufMut_boxed_Box_Vec_u8, putI8$bytes_BufMut_boxed_Box_bytes_BytesMut, putSlice$bytes_BufMut_boxed_Box_Vec_u8, putSlice$bytes_BufMut_boxed_Box_bytes_BytesMut, putU16$bytes_BufMut_boxed_Box_Vec_u8, putU16$bytes_BufMut_boxed_Box_bytes_BytesMut, putU32$bytes_BufMut_boxed_Box_Vec_u8, putU32$bytes_BufMut_boxed_Box_bytes_BytesMut, putU64Le$bytes_BufMut_boxed_Box_Vec_u8, putU64Le$bytes_BufMut_boxed_Box_bytes_BytesMut, putU8$bytes_BufMut_boxed_Box_Vec_u8, putU8$bytes_BufMut_boxed_Box_bytes_BytesMut } from "./bytes/buf/buf_mut.ts"; +import * as Take from "./bytes/buf/take.Take.ts"; +import type * as TryGetError from "./bytes.TryGetError.ts"; import { then$1y5f3ge } from "./core/bool.ts"; +import { map$0c3nzkx as result_map$0c3nzkx, map$0hs8st9 as result_map$0hs8st9, map$01kzrm1 as result_map$01kzrm1 } from "./core/result.ts"; /** * A `BytesMut` split, frozen, grown, and written, ending with every piece's bytes: a @@ -133,49 +139,368 @@ export function getU8Checked$buf_Checked_bytes_BytesMut(self: rt.BytesMut): rt.u return rt.bytesMutReadWord(self, 1, false) as rt.u8; } -/** A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes. */ +/** + * A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes, or a + * `try_get_*`'s error as what it asked for and what remained. + */ +export function read$boxed_Box_dyn_bytes_Buf(buf: rt.Place, n: rt.usize): rt.u128 { + const _3: (a0: rt.Result) => rt.u128 = (got: rt.Result): rt.u128 => { + if (got.ok) { + return got.value; + } + const e: TryGetError.TryGetError = got.error; + return rt.u128Or(rt.u128Shl(e.requested as rt.u128, 64), e.available as rt.u128); + }; + const _4: rt.usize = rt.usizeRem(n, 19); + if (_4 === 15) { + const part8: rt.u16 | undefined = tryGetU16$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf); + const err4: TryGetError.TryGetError | undefined = part8 === undefined ? Pieces.tryGetU16Out$bytes_Buf_mut.err as TryGetError.TryGetError : undefined; + const part9 = result_map$0hs8st9((err4 !== undefined ? rt.Err(err4 as TryGetError.TryGetError) : rt.Ok(part8 as rt.u16)) as rt.Result, (a02: rt.u16): rt.u128 => { + return a02 as rt.u128; + }); + return _3(part9); + } + if (_4 === 16) { + const part6: rt.i64 | undefined = tryGetI64Le$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf); + const err3: TryGetError.TryGetError | undefined = part6 === undefined ? Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part7 = result_map$0c3nzkx((err3 !== undefined ? rt.Err(err3 as TryGetError.TryGetError) : rt.Ok(part6 as rt.i64)) as rt.Result, (v2: rt.i64): rt.u128 => { + return rt.u128Cast(v2); + }); + return _3(part7); + } + if (_4 === 17) { + const part5: rt.u128 | undefined = tryGetU128$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf); + const err2: TryGetError.TryGetError | undefined = part5 === undefined ? Pieces.tryGetU128Out$bytes_Buf_mut.err as TryGetError.TryGetError : undefined; + const args = [(err2 !== undefined ? rt.Err(err2 as TryGetError.TryGetError) : rt.Ok(part5 as rt.u128)) as rt.Result] as [rt.Result]; + return _3(args[0]); + } + if (_4 === 18) { + const part3: rt.u8 | undefined = tryGetU8$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf); + const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { + return a0 as rt.u128; + }); + return _3(part4); + } + if (_4 === 0) { + return getU8$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf) as rt.u128; + } + if (_4 === 1) { + return rt.u128Cast(getI8$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf)); + } + if (_4 === 2) { + return getU16$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf) as rt.u128; + } + if (_4 === 3) { + return rt.u128Cast(getI16Le$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf)); + } + if (_4 === 4) { + return getU32Le$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf) as rt.u128; + } + if (_4 === 5) { + return rt.u128Cast(getI32$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf)); + } + if (_4 === 6) { + return rt.u128Cast(getU64$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf)); + } + if (_4 === 7) { + return rt.u128Cast(getI64Le$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf)); + } + if (_4 === 8) { + return getU128Le$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf); + } + if (_4 === 9) { + return rt.u128Cast(getI128$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf)); + } + if (_4 === 10) { + return rt.u128Cast(getUint$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf, rt.usizeRem(n, 10))); + } + if (_4 === 11) { + return rt.u128Cast(getIntLe$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf, rt.usizeRem(n, 10))); + } + if (_4 === 12) { + return rt.u128Cast(rt.f64ToBits(getF64$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf))); + } + if (_4 === 13) { + return rt.f32ToBits(getF32Le$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf)) as rt.u128; + } + const dst: Uint8Array = rt.bytes(3); + const part = rt.usizeRem(n, 4); + copyToSlice$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf, rt.byteSliceRange(rt.byteSliceFrom(dst), 0, part)); + return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; +} + +/** + * A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes, or a + * `try_get_*`'s error as what it asked for and what remained. + */ +export function read$buf_Pieces(buf: Pieces.Pieces, n: rt.usize): rt.u128 { + const _3: (a0: rt.Result) => rt.u128 = (got: rt.Result): rt.u128 => { + if (got.ok) { + return got.value; + } + const e: TryGetError.TryGetError = got.error; + return rt.u128Or(rt.u128Shl(e.requested as rt.u128, 64), e.available as rt.u128); + }; + const _4: rt.usize = rt.usizeRem(n, 19); + if (_4 === 15) { + const part7 = result_map$0hs8st9(rt.bufTryGet(buf, 2, false, rt.u16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined), (a046: rt.u16): rt.u128 => { + return a046 as rt.u128; + }); + return _3(part7); + } + if (_4 === 16) { + const part6 = result_map$0c3nzkx(rt.bufTryGet(buf, 8, true, rt.i64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined), (v2: rt.i64): rt.u128 => { + return rt.u128Cast(v2); + }); + return _3(part6); + } + if (_4 === 17) { + const part5 = rt.bufTryGet(buf, 16, false, rt.u128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + return _3(part5); + } + if (_4 === 18) { + const part3: rt.u8 | undefined = Pieces.tryGetU8$bytes_Buf(buf); + const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a033: rt.u8): rt.u128 => { + return a033 as rt.u128; + }); + return _3(part4); + } + if (_4 === 0) { + return Pieces.getU8$bytes_Buf(buf) as rt.u128; + } + if (_4 === 1) { + return rt.u128Cast(Pieces.getI8$bytes_Buf(buf)); + } + if (_4 === 2) { + return rt.bufGet(buf, 2, false, rt.u16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined) as rt.u128; + } + if (_4 === 3) { + return rt.u128Cast(rt.bufGet(buf, 2, true, rt.i16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 4) { + return rt.bufGet(buf, 4, true, rt.u32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined) as rt.u128; + } + if (_4 === 5) { + return rt.u128Cast(rt.bufGet(buf, 4, false, rt.i32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 6) { + return rt.u128Cast(rt.bufGet(buf, 8, false, rt.u64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 7) { + return rt.u128Cast(rt.bufGet(buf, 8, true, rt.i64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 8) { + return rt.bufGet(buf, 16, true, rt.u128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + if (_4 === 9) { + return rt.u128Cast(rt.bufGet(buf, 16, false, rt.i128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 10) { + return rt.u128Cast(Pieces.getUint$bytes_Buf(buf, rt.usizeRem(n, 10))); + } + if (_4 === 11) { + return rt.u128Cast(Pieces.getIntLe$bytes_Buf(buf, rt.usizeRem(n, 10))); + } + if (_4 === 12) { + return rt.u128Cast(rt.f64ToBits(Pieces.getF64$bytes_Buf(buf))); + } + if (_4 === 13) { + return rt.f32ToBits(Pieces.getF32Le$bytes_Buf(buf)) as rt.u128; + } + const dst: Uint8Array = rt.bytes(3); + const part = rt.usizeRem(n, 4); + Pieces.copyToSlice$bytes_Buf(buf, rt.byteSliceRange(rt.byteSliceFrom(dst), 0, part)); + return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; +} + +/** + * A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes, or a + * `try_get_*`'s error as what it asked for and what remained. + */ +export function read$buf_Provided(buf: Provided.Provided, n: rt.usize): rt.u128 { + const _3: (a0: rt.Result) => rt.u128 = (got: rt.Result): rt.u128 => { + if (got.ok) { + return got.value; + } + const e: TryGetError.TryGetError = got.error; + return rt.u128Or(rt.u128Shl(e.requested as rt.u128, 64), e.available as rt.u128); + }; + const _4: rt.usize = rt.usizeRem(n, 19); + if (_4 === 15) { + const part7 = result_map$0hs8st9(rt.bufTryGet(buf, 2, false, rt.u16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined), (a046: rt.u16): rt.u128 => { + return a046 as rt.u128; + }); + return _3(part7); + } + if (_4 === 16) { + const part6 = result_map$0c3nzkx(rt.bufTryGet(buf, 8, true, rt.i64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined), (v2: rt.i64): rt.u128 => { + return rt.u128Cast(v2); + }); + return _3(part6); + } + if (_4 === 17) { + const part5 = rt.bufTryGet(buf, 16, false, rt.u128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + return _3(part5); + } + if (_4 === 18) { + const part3: rt.u8 | undefined = Provided.tryGetU8$bytes_Buf(buf); + const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a033: rt.u8): rt.u128 => { + return a033 as rt.u128; + }); + return _3(part4); + } + if (_4 === 0) { + return Provided.getU8$bytes_Buf(buf) as rt.u128; + } + if (_4 === 1) { + return rt.u128Cast(Provided.getI8$bytes_Buf(buf)); + } + if (_4 === 2) { + return rt.bufGet(buf, 2, false, rt.u16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined) as rt.u128; + } + if (_4 === 3) { + return rt.u128Cast(rt.bufGet(buf, 2, true, rt.i16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 4) { + return rt.bufGet(buf, 4, true, rt.u32FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined) as rt.u128; + } + if (_4 === 5) { + return rt.u128Cast(rt.bufGet(buf, 4, false, rt.i32FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 6) { + return rt.u128Cast(rt.bufGet(buf, 8, false, rt.u64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 7) { + return rt.u128Cast(rt.bufGet(buf, 8, true, rt.i64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 8) { + return rt.bufGet(buf, 16, true, rt.u128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + if (_4 === 9) { + return rt.u128Cast(rt.bufGet(buf, 16, false, rt.i128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 10) { + return rt.u128Cast(Provided.getUint$bytes_Buf(buf, rt.usizeRem(n, 10))); + } + if (_4 === 11) { + return rt.u128Cast(Provided.getIntLe$bytes_Buf(buf, rt.usizeRem(n, 10))); + } + if (_4 === 12) { + return rt.u128Cast(rt.f64ToBits(Provided.getF64$bytes_Buf(buf))); + } + if (_4 === 13) { + return rt.f32ToBits(Provided.getF32Le$bytes_Buf(buf)) as rt.u128; + } + const dst: Uint8Array = rt.bytes(3); + const part = rt.usizeRem(n, 4); + Provided.copyToSlice$bytes_Buf(buf, rt.byteSliceRange(rt.byteSliceFrom(dst), 0, part)); + return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; +} + +/** + * A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes, or a + * `try_get_*`'s error as what it asked for and what remained. + */ export function read$bytes_Bytes(buf: rt.Place, n: rt.usize): rt.u128 { - const _3: rt.usize = rt.usizeRem(n, 15); - if (_3 === 0) { + const _3: (a0: rt.Result) => rt.u128 = (got: rt.Result): rt.u128 => { + if (got.ok) { + return got.value; + } + const e: TryGetError.TryGetError = got.error; + return rt.u128Or(rt.u128Shl(e.requested as rt.u128, 64), e.available as rt.u128); + }; + const _4: rt.usize = rt.usizeRem(n, 19); + if (_4 === 15) { + const part7 = result_map$0hs8st9(rt.bufTryGet(buf, 2, false, rt.u16FromBeBytes, (p: rt.Place) => ((a010: rt.ByteSlice): rt.usize => { + return a010.length; + })(p.v), (p: rt.Place) => ((a011: rt.ByteSlice): rt.ByteSlice => { + return a011; + })(p.v), (a012: rt.Place, a15: rt.usize): undefined => { + rt.bytesAdvance(a012, a15); + }, (a013: rt.Place, a16: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a013, a16); + }), (a014: rt.u16): rt.u128 => { + return a014 as rt.u128; + }); + return _3(part7); + } + if (_4 === 16) { + const part6 = result_map$0c3nzkx(rt.bufTryGet(buf, 8, true, rt.i64FromBeBytes, (p: rt.Place) => ((a06: rt.ByteSlice): rt.usize => { + return a06.length; + })(p.v), (p: rt.Place) => ((a07: rt.ByteSlice): rt.ByteSlice => { + return a07; + })(p.v), (a08: rt.Place, a13: rt.usize): undefined => { + rt.bytesAdvance(a08, a13); + }, (a09: rt.Place, a14: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a09, a14); + }), (v2: rt.i64): rt.u128 => { + return rt.u128Cast(v2); + }); + return _3(part6); + } + if (_4 === 17) { + const part5 = rt.bufTryGet(buf, 16, false, rt.u128FromBeBytes, (p: rt.Place) => ((a02: rt.ByteSlice): rt.usize => { + return a02.length; + })(p.v), (p: rt.Place) => ((a03: rt.ByteSlice): rt.ByteSlice => { + return a03; + })(p.v), (a04: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a04, a1); + }, (a05: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a05, a12); + }); + return _3(part5); + } + if (_4 === 18) { + const part3: rt.u8 | undefined = tryGetU8$bytes_Buf_bytes_Bytes(buf); + const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { + return a0 as rt.u128; + }); + return _3(part4); + } + if (_4 === 0) { return ((rt.bytesReadWord(buf, 1, false) as rt.u8)) as rt.u128; } - if (_3 === 1) { + if (_4 === 1) { return rt.u128Cast((rt.bytesReadWord(buf, 1, false) << 24) >> 24 as rt.i8); } - if (_3 === 2) { + if (_4 === 2) { return ((rt.bytesReadWord(buf, 2, false) as rt.u16)) as rt.u128; } - if (_3 === 3) { + if (_4 === 3) { return rt.u128Cast((rt.bytesReadWord(buf, 2, true) << 16) >> 16 as rt.i16); } - if (_3 === 4) { + if (_4 === 4) { return ((rt.bytesReadWord(buf, 4, true) as rt.u32)) as rt.u128; } - if (_3 === 5) { + if (_4 === 5) { return rt.u128Cast((rt.bytesReadWord(buf, 4, false) | 0) as rt.i32); } - if (_3 === 6) { + if (_4 === 6) { return rt.u128Cast(rt.u64FromBeBytes(rt.bytesRead(buf, 8, false))); } - if (_3 === 7) { + if (_4 === 7) { return rt.u128Cast(rt.i64FromBeBytes(rt.bytesRead(buf, 8, true))); } - if (_3 === 8) { + if (_4 === 8) { return rt.u128FromBeBytes(rt.bytesRead(buf, 16, true)); } - if (_3 === 9) { + if (_4 === 9) { return rt.u128Cast(rt.i128FromBeBytes(rt.bytesRead(buf, 16, false))); } - if (_3 === 10) { + if (_4 === 10) { return rt.u128Cast(rt.u64FromBeBytes(rt.bytesReadInt(buf, 8, rt.usizeRem(n, 10), false, false))); } - if (_3 === 11) { + if (_4 === 11) { return rt.u128Cast(rt.i64FromBeBytes(rt.bytesReadInt(buf, 8, rt.usizeRem(n, 10), true, true))); } - if (_3 === 12) { + if (_4 === 12) { return rt.u128Cast(rt.f64ToBits(rt.f64FromBeBytes(rt.bytesRead(buf, 8, false)))); } - if (_3 === 13) { + if (_4 === 13) { return rt.f32ToBits(rt.f32FromBeBytes(rt.bytesRead(buf, 4, true))) as rt.u128; } const dst: Uint8Array = rt.bytes(3); @@ -184,49 +509,107 @@ export function read$bytes_Bytes(buf: rt.Place, n: rt.usize): rt.u return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; } -/** A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes. */ +/** + * A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes, or a + * `try_get_*`'s error as what it asked for and what remained. + */ export function read$bytes_BytesMut(buf: rt.BytesMut, n: rt.usize): rt.u128 { - const _3: rt.usize = rt.usizeRem(n, 15); - if (_3 === 0) { + const _3: (a0: rt.Result) => rt.u128 = (got: rt.Result): rt.u128 => { + if (got.ok) { + return got.value; + } + const e: TryGetError.TryGetError = got.error; + return rt.u128Or(rt.u128Shl(e.requested as rt.u128, 64), e.available as rt.u128); + }; + const _4: rt.usize = rt.usizeRem(n, 19); + if (_4 === 15) { + const part7 = result_map$0hs8st9(rt.bufTryGet(buf, 2, false, rt.u16FromBeBytes, (a010: rt.BytesMut): rt.usize => { + return a010.length; + }, (a011: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a011); + }, (a012: rt.BytesMut, a15: rt.usize): undefined => { + rt.bytesMutAdvance(a012, a15); + }, (a013: rt.BytesMut, a16: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a013, a16); + }), (a014: rt.u16): rt.u128 => { + return a014 as rt.u128; + }); + return _3(part7); + } + if (_4 === 16) { + const part6 = result_map$0c3nzkx(rt.bufTryGet(buf, 8, true, rt.i64FromBeBytes, (a06: rt.BytesMut): rt.usize => { + return a06.length; + }, (a07: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a07); + }, (a08: rt.BytesMut, a13: rt.usize): undefined => { + rt.bytesMutAdvance(a08, a13); + }, (a09: rt.BytesMut, a14: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a09, a14); + }), (v2: rt.i64): rt.u128 => { + return rt.u128Cast(v2); + }); + return _3(part6); + } + if (_4 === 17) { + const part5 = rt.bufTryGet(buf, 16, false, rt.u128FromBeBytes, (a02: rt.BytesMut): rt.usize => { + return a02.length; + }, (a03: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a03); + }, (a04: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a04, a1); + }, (a05: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a05, a12); + }); + return _3(part5); + } + if (_4 === 18) { + const part3: rt.u8 | undefined = tryGetU8$bytes_Buf_bytes_BytesMut(buf); + const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { + return a0 as rt.u128; + }); + return _3(part4); + } + if (_4 === 0) { return ((rt.bytesMutReadWord(buf, 1, false) as rt.u8)) as rt.u128; } - if (_3 === 1) { + if (_4 === 1) { return rt.u128Cast((rt.bytesMutReadWord(buf, 1, false) << 24) >> 24 as rt.i8); } - if (_3 === 2) { + if (_4 === 2) { return ((rt.bytesMutReadWord(buf, 2, false) as rt.u16)) as rt.u128; } - if (_3 === 3) { + if (_4 === 3) { return rt.u128Cast((rt.bytesMutReadWord(buf, 2, true) << 16) >> 16 as rt.i16); } - if (_3 === 4) { + if (_4 === 4) { return ((rt.bytesMutReadWord(buf, 4, true) as rt.u32)) as rt.u128; } - if (_3 === 5) { + if (_4 === 5) { return rt.u128Cast((rt.bytesMutReadWord(buf, 4, false) | 0) as rt.i32); } - if (_3 === 6) { + if (_4 === 6) { return rt.u128Cast(rt.u64FromBeBytes(rt.bytesMutRead(buf, 8, false))); } - if (_3 === 7) { + if (_4 === 7) { return rt.u128Cast(rt.i64FromBeBytes(rt.bytesMutRead(buf, 8, true))); } - if (_3 === 8) { + if (_4 === 8) { return rt.u128FromBeBytes(rt.bytesMutRead(buf, 16, true)); } - if (_3 === 9) { + if (_4 === 9) { return rt.u128Cast(rt.i128FromBeBytes(rt.bytesMutRead(buf, 16, false))); } - if (_3 === 10) { + if (_4 === 10) { return rt.u128Cast(rt.u64FromBeBytes(rt.bytesMutReadInt(buf, 8, rt.usizeRem(n, 10), false, false))); } - if (_3 === 11) { + if (_4 === 11) { return rt.u128Cast(rt.i64FromBeBytes(rt.bytesMutReadInt(buf, 8, rt.usizeRem(n, 10), true, true))); } - if (_3 === 12) { + if (_4 === 12) { return rt.u128Cast(rt.f64ToBits(rt.f64FromBeBytes(rt.bytesMutRead(buf, 8, false)))); } - if (_3 === 13) { + if (_4 === 13) { return rt.f32ToBits(rt.f32FromBeBytes(rt.bytesMutRead(buf, 4, true))) as rt.u128; } const dst: Uint8Array = rt.bytes(3); @@ -235,49 +618,431 @@ export function read$bytes_BytesMut(buf: rt.BytesMut, n: rt.usize): rt.u128 { return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; } -/** A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes. */ +/** + * A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes, or a + * `try_get_*`'s error as what it asked for and what remained. + */ +export function read$bytes_buf_Take_bytes_Bytes(buf: Take.Take, n: rt.usize): rt.u128 { + const _3: (a0: rt.Result) => rt.u128 = (got: rt.Result): rt.u128 => { + if (got.ok) { + return got.value; + } + const e: TryGetError.TryGetError = got.error; + return rt.u128Or(rt.u128Shl(e.requested as rt.u128, 64), e.available as rt.u128); + }; + const _4: rt.usize = rt.usizeRem(n, 19); + if (_4 === 15) { + const part7 = result_map$0hs8st9(rt.bufTryGet(buf, 2, false, rt.u16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined), (a046: rt.u16): rt.u128 => { + return a046 as rt.u128; + }); + return _3(part7); + } + if (_4 === 16) { + const part6 = result_map$0c3nzkx(rt.bufTryGet(buf, 8, true, rt.i64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined), (v2: rt.i64): rt.u128 => { + return rt.u128Cast(v2); + }); + return _3(part6); + } + if (_4 === 17) { + const part5 = rt.bufTryGet(buf, 16, false, rt.u128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + return _3(part5); + } + if (_4 === 18) { + const part3: rt.u8 | undefined = Take.tryGetU8$bytes_Buf_bytes_Bytes(buf); + const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a033: rt.u8): rt.u128 => { + return a033 as rt.u128; + }); + return _3(part4); + } + if (_4 === 0) { + return Take.getU8$bytes_Buf_bytes_Bytes(buf) as rt.u128; + } + if (_4 === 1) { + return rt.u128Cast(Take.getI8$bytes_Buf_bytes_Bytes(buf)); + } + if (_4 === 2) { + return rt.bufGet(buf, 2, false, rt.u16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined) as rt.u128; + } + if (_4 === 3) { + return rt.u128Cast(rt.bufGet(buf, 2, true, rt.i16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 4) { + return rt.bufGet(buf, 4, true, rt.u32FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined) as rt.u128; + } + if (_4 === 5) { + return rt.u128Cast(rt.bufGet(buf, 4, false, rt.i32FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 6) { + return rt.u128Cast(rt.bufGet(buf, 8, false, rt.u64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 7) { + return rt.u128Cast(rt.bufGet(buf, 8, true, rt.i64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 8) { + return rt.bufGet(buf, 16, true, rt.u128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + if (_4 === 9) { + return rt.u128Cast(rt.bufGet(buf, 16, false, rt.i128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined)); + } + if (_4 === 10) { + return rt.u128Cast(Take.getUint$bytes_Buf_bytes_Bytes(buf, rt.usizeRem(n, 10))); + } + if (_4 === 11) { + return rt.u128Cast(Take.getIntLe$bytes_Buf_bytes_Bytes(buf, rt.usizeRem(n, 10))); + } + if (_4 === 12) { + return rt.u128Cast(rt.f64ToBits(Take.getF64$bytes_Buf_bytes_Bytes(buf))); + } + if (_4 === 13) { + return rt.f32ToBits(Take.getF32Le$bytes_Buf_bytes_Bytes(buf)) as rt.u128; + } + const dst: Uint8Array = rt.bytes(3); + const part = rt.usizeRem(n, 4); + Take.copyToSlice$bytes_Buf_bytes_Bytes(buf, rt.byteSliceRange(rt.byteSliceFrom(dst), 0, part)); + return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; +} + +/** + * A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes, or a + * `try_get_*`'s error as what it asked for and what remained. + */ +export function read$dyn_buf_Leased(buf: Leased.Leased, n: rt.usize): rt.u128 { + const _3: (a0: rt.Result) => rt.u128 = (got: rt.Result): rt.u128 => { + if (got.ok) { + return got.value; + } + const e: TryGetError.TryGetError = got.error; + return rt.u128Or(rt.u128Shl(e.requested as rt.u128, 64), e.available as rt.u128); + }; + const _4: rt.usize = rt.usizeRem(n, 19); + if (_4 === 15) { + const part6 = result_map$0hs8st9(buf.tryGetU16$Buf(), (a02: rt.u16): rt.u128 => { + return a02 as rt.u128; + }); + return _3(part6); + } + if (_4 === 16) { + const part5 = result_map$0c3nzkx(buf.tryGetI64Le$Buf(), (v2: rt.i64): rt.u128 => { + return rt.u128Cast(v2); + }); + return _3(part5); + } + if (_4 === 17) { + const part4 = buf.tryGetU128$Buf(); + return _3(part4); + } + if (_4 === 18) { + const part3 = result_map$01kzrm1(buf.tryGetU8$Buf(), (a0: rt.u8): rt.u128 => { + return a0 as rt.u128; + }); + return _3(part3); + } + if (_4 === 0) { + return buf.getU8$Buf() as rt.u128; + } + if (_4 === 1) { + return rt.u128Cast(buf.getI8$Buf()); + } + if (_4 === 2) { + return buf.getU16$Buf() as rt.u128; + } + if (_4 === 3) { + return rt.u128Cast(buf.getI16Le$Buf()); + } + if (_4 === 4) { + return buf.getU32Le$Buf() as rt.u128; + } + if (_4 === 5) { + return rt.u128Cast(buf.getI32$Buf()); + } + if (_4 === 6) { + return rt.u128Cast(buf.getU64$Buf()); + } + if (_4 === 7) { + return rt.u128Cast(buf.getI64Le$Buf()); + } + if (_4 === 8) { + return buf.getU128Le$Buf(); + } + if (_4 === 9) { + return rt.u128Cast(buf.getI128$Buf()); + } + if (_4 === 10) { + return rt.u128Cast(buf.getUint$Buf(rt.usizeRem(n, 10))); + } + if (_4 === 11) { + return rt.u128Cast(buf.getIntLe$Buf(rt.usizeRem(n, 10))); + } + if (_4 === 12) { + return rt.u128Cast(rt.f64ToBits(buf.getF64$Buf())); + } + if (_4 === 13) { + return rt.f32ToBits(buf.getF32Le$Buf()) as rt.u128; + } + const dst: Uint8Array = rt.bytes(3); + const part = rt.usizeRem(n, 4); + buf.copyToSlice$Buf(rt.byteSliceRange(rt.byteSliceFrom(dst), 0, part)); + return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; +} + +/** + * A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes, or a + * `try_get_*`'s error as what it asked for and what remained. + */ +export function read$dyn_bytes_Buf(buf: Buf.Buf, n: rt.usize): rt.u128 { + const _3: (a0: rt.Result) => rt.u128 = (got: rt.Result): rt.u128 => { + if (got.ok) { + return got.value; + } + const e: TryGetError.TryGetError = got.error; + return rt.u128Or(rt.u128Shl(e.requested as rt.u128, 64), e.available as rt.u128); + }; + const _4: rt.usize = rt.usizeRem(n, 19); + if (_4 === 15) { + const part6 = result_map$0hs8st9(buf.tryGetU16$Buf(), (a02: rt.u16): rt.u128 => { + return a02 as rt.u128; + }); + return _3(part6); + } + if (_4 === 16) { + const part5 = result_map$0c3nzkx(buf.tryGetI64Le$Buf(), (v2: rt.i64): rt.u128 => { + return rt.u128Cast(v2); + }); + return _3(part5); + } + if (_4 === 17) { + const part4 = buf.tryGetU128$Buf(); + return _3(part4); + } + if (_4 === 18) { + const part3 = result_map$01kzrm1(buf.tryGetU8$Buf(), (a0: rt.u8): rt.u128 => { + return a0 as rt.u128; + }); + return _3(part3); + } + if (_4 === 0) { + return buf.getU8$Buf() as rt.u128; + } + if (_4 === 1) { + return rt.u128Cast(buf.getI8$Buf()); + } + if (_4 === 2) { + return buf.getU16$Buf() as rt.u128; + } + if (_4 === 3) { + return rt.u128Cast(buf.getI16Le$Buf()); + } + if (_4 === 4) { + return buf.getU32Le$Buf() as rt.u128; + } + if (_4 === 5) { + return rt.u128Cast(buf.getI32$Buf()); + } + if (_4 === 6) { + return rt.u128Cast(buf.getU64$Buf()); + } + if (_4 === 7) { + return rt.u128Cast(buf.getI64Le$Buf()); + } + if (_4 === 8) { + return buf.getU128Le$Buf(); + } + if (_4 === 9) { + return rt.u128Cast(buf.getI128$Buf()); + } + if (_4 === 10) { + return rt.u128Cast(buf.getUint$Buf(rt.usizeRem(n, 10))); + } + if (_4 === 11) { + return rt.u128Cast(buf.getIntLe$Buf(rt.usizeRem(n, 10))); + } + if (_4 === 12) { + return rt.u128Cast(rt.f64ToBits(buf.getF64$Buf())); + } + if (_4 === 13) { + return rt.f32ToBits(buf.getF32Le$Buf()) as rt.u128; + } + const dst: Uint8Array = rt.bytes(3); + const part = rt.usizeRem(n, 4); + buf.copyToSlice$Buf(rt.byteSliceRange(rt.byteSliceFrom(dst), 0, part)); + return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; +} + +/** + * A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes, or a + * `try_get_*`'s error as what it asked for and what remained. + */ +export function read$mut_buf_Pieces(buf: rt.Place, n: rt.usize): rt.u128 { + const _3: (a0: rt.Result) => rt.u128 = (got: rt.Result): rt.u128 => { + if (got.ok) { + return got.value; + } + const e: TryGetError.TryGetError = got.error; + return rt.u128Or(rt.u128Shl(e.requested as rt.u128, 64), e.available as rt.u128); + }; + const _4: rt.usize = rt.usizeRem(n, 19); + if (_4 === 15) { + const part8: rt.u16 | undefined = Pieces.tryGetU16$bytes_Buf_mut(buf); + const err4: TryGetError.TryGetError | undefined = part8 === undefined ? Pieces.tryGetU16Out$bytes_Buf_mut.err as TryGetError.TryGetError : undefined; + const part9 = result_map$0hs8st9((err4 !== undefined ? rt.Err(err4 as TryGetError.TryGetError) : rt.Ok(part8 as rt.u16)) as rt.Result, (a02: rt.u16): rt.u128 => { + return a02 as rt.u128; + }); + return _3(part9); + } + if (_4 === 16) { + const part6: rt.i64 | undefined = Pieces.tryGetI64Le$bytes_Buf_mut(buf); + const err3: TryGetError.TryGetError | undefined = part6 === undefined ? Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part7 = result_map$0c3nzkx((err3 !== undefined ? rt.Err(err3 as TryGetError.TryGetError) : rt.Ok(part6 as rt.i64)) as rt.Result, (v2: rt.i64): rt.u128 => { + return rt.u128Cast(v2); + }); + return _3(part7); + } + if (_4 === 17) { + const part5: rt.u128 | undefined = Pieces.tryGetU128$bytes_Buf_mut(buf); + const err2: TryGetError.TryGetError | undefined = part5 === undefined ? Pieces.tryGetU128Out$bytes_Buf_mut.err as TryGetError.TryGetError : undefined; + const args = [(err2 !== undefined ? rt.Err(err2 as TryGetError.TryGetError) : rt.Ok(part5 as rt.u128)) as rt.Result] as [rt.Result]; + return _3(args[0]); + } + if (_4 === 18) { + const part3: rt.u8 | undefined = Pieces.tryGetU8$bytes_Buf_mut(buf); + const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { + return a0 as rt.u128; + }); + return _3(part4); + } + if (_4 === 0) { + return Pieces.getU8$bytes_Buf_mut(buf) as rt.u128; + } + if (_4 === 1) { + return rt.u128Cast(Pieces.getI8$bytes_Buf_mut(buf)); + } + if (_4 === 2) { + return Pieces.getU16$bytes_Buf_mut(buf) as rt.u128; + } + if (_4 === 3) { + return rt.u128Cast(Pieces.getI16Le$bytes_Buf_mut(buf)); + } + if (_4 === 4) { + return Pieces.getU32Le$bytes_Buf_mut(buf) as rt.u128; + } + if (_4 === 5) { + return rt.u128Cast(Pieces.getI32$bytes_Buf_mut(buf)); + } + if (_4 === 6) { + return rt.u128Cast(Pieces.getU64$bytes_Buf_mut(buf)); + } + if (_4 === 7) { + return rt.u128Cast(Pieces.getI64Le$bytes_Buf_mut(buf)); + } + if (_4 === 8) { + return Pieces.getU128Le$bytes_Buf_mut(buf); + } + if (_4 === 9) { + return rt.u128Cast(Pieces.getI128$bytes_Buf_mut(buf)); + } + if (_4 === 10) { + return rt.u128Cast(Pieces.getUint$bytes_Buf_mut(buf, rt.usizeRem(n, 10))); + } + if (_4 === 11) { + return rt.u128Cast(Pieces.getIntLe$bytes_Buf_mut(buf, rt.usizeRem(n, 10))); + } + if (_4 === 12) { + return rt.u128Cast(rt.f64ToBits(Pieces.getF64$bytes_Buf_mut(buf))); + } + if (_4 === 13) { + return rt.f32ToBits(Pieces.getF32Le$bytes_Buf_mut(buf)) as rt.u128; + } + const dst: Uint8Array = rt.bytes(3); + const part = rt.usizeRem(n, 4); + Pieces.copyToSlice$bytes_Buf_mut(buf, rt.byteSliceRange(rt.byteSliceFrom(dst), 0, part)); + return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; +} + +/** + * A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes, or a + * `try_get_*`'s error as what it asked for and what remained. + */ export function read$mut_bytes_Bytes(buf: rt.Place>, n: rt.usize): rt.u128 { - const _3: rt.usize = rt.usizeRem(n, 15); - if (_3 === 0) { + const _3: (a0: rt.Result) => rt.u128 = (got: rt.Result): rt.u128 => { + if (got.ok) { + return got.value; + } + const e: TryGetError.TryGetError = got.error; + return rt.u128Or(rt.u128Shl(e.requested as rt.u128, 64), e.available as rt.u128); + }; + const _4: rt.usize = rt.usizeRem(n, 19); + if (_4 === 15) { + const part8: rt.u16 | undefined = tryGetU16$bytes_Buf_mut_bytes_Bytes(buf); + const err4: TryGetError.TryGetError | undefined = part8 === undefined ? Pieces.tryGetU16Out$bytes_Buf_mut.err as TryGetError.TryGetError : undefined; + const part9 = result_map$0hs8st9((err4 !== undefined ? rt.Err(err4 as TryGetError.TryGetError) : rt.Ok(part8 as rt.u16)) as rt.Result, (a02: rt.u16): rt.u128 => { + return a02 as rt.u128; + }); + return _3(part9); + } + if (_4 === 16) { + const part6: rt.i64 | undefined = tryGetI64Le$bytes_Buf_mut_bytes_Bytes(buf); + const err3: TryGetError.TryGetError | undefined = part6 === undefined ? Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part7 = result_map$0c3nzkx((err3 !== undefined ? rt.Err(err3 as TryGetError.TryGetError) : rt.Ok(part6 as rt.i64)) as rt.Result, (v2: rt.i64): rt.u128 => { + return rt.u128Cast(v2); + }); + return _3(part7); + } + if (_4 === 17) { + const part5: rt.u128 | undefined = tryGetU128$bytes_Buf_mut_bytes_Bytes(buf); + const err2: TryGetError.TryGetError | undefined = part5 === undefined ? Pieces.tryGetU128Out$bytes_Buf_mut.err as TryGetError.TryGetError : undefined; + const args = [(err2 !== undefined ? rt.Err(err2 as TryGetError.TryGetError) : rt.Ok(part5 as rt.u128)) as rt.Result] as [rt.Result]; + return _3(args[0]); + } + if (_4 === 18) { + const part3: rt.u8 | undefined = tryGetU8$bytes_Buf_mut_bytes_Bytes(buf); + const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { + return a0 as rt.u128; + }); + return _3(part4); + } + if (_4 === 0) { return getU8$bytes_Buf_mut_bytes_Bytes(buf) as rt.u128; } - if (_3 === 1) { + if (_4 === 1) { return rt.u128Cast(getI8$bytes_Buf_mut_bytes_Bytes(buf)); } - if (_3 === 2) { + if (_4 === 2) { return getU16$bytes_Buf_mut_bytes_Bytes(buf) as rt.u128; } - if (_3 === 3) { + if (_4 === 3) { return rt.u128Cast(getI16Le$bytes_Buf_mut_bytes_Bytes(buf)); } - if (_3 === 4) { + if (_4 === 4) { return getU32Le$bytes_Buf_mut_bytes_Bytes(buf) as rt.u128; } - if (_3 === 5) { + if (_4 === 5) { return rt.u128Cast(getI32$bytes_Buf_mut_bytes_Bytes(buf)); } - if (_3 === 6) { + if (_4 === 6) { return rt.u128Cast(getU64$bytes_Buf_mut_bytes_Bytes(buf)); } - if (_3 === 7) { + if (_4 === 7) { return rt.u128Cast(getI64Le$bytes_Buf_mut_bytes_Bytes(buf)); } - if (_3 === 8) { + if (_4 === 8) { return getU128Le$bytes_Buf_mut_bytes_Bytes(buf); } - if (_3 === 9) { + if (_4 === 9) { return rt.u128Cast(getI128$bytes_Buf_mut_bytes_Bytes(buf)); } - if (_3 === 10) { + if (_4 === 10) { return rt.u128Cast(getUint$bytes_Buf_mut_bytes_Bytes(buf, rt.usizeRem(n, 10))); } - if (_3 === 11) { + if (_4 === 11) { return rt.u128Cast(getIntLe$bytes_Buf_mut_bytes_Bytes(buf, rt.usizeRem(n, 10))); } - if (_3 === 12) { + if (_4 === 12) { return rt.u128Cast(rt.f64ToBits(getF64$bytes_Buf_mut_bytes_Bytes(buf))); } - if (_3 === 13) { + if (_4 === 13) { return rt.f32ToBits(getF32Le$bytes_Buf_mut_bytes_Bytes(buf)) as rt.u128; } const dst: Uint8Array = rt.bytes(3); @@ -286,49 +1051,180 @@ export function read$mut_bytes_Bytes(buf: rt.Place>, n: r return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; } -/** A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes. */ +/** + * A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes, or a + * `try_get_*`'s error as what it asked for and what remained. + */ +export function read$mut_dyn_bytes_Buf(buf: rt.Place, n: rt.usize): rt.u128 { + const _3: (a0: rt.Result) => rt.u128 = (got: rt.Result): rt.u128 => { + if (got.ok) { + return got.value; + } + const e: TryGetError.TryGetError = got.error; + return rt.u128Or(rt.u128Shl(e.requested as rt.u128, 64), e.available as rt.u128); + }; + const _4: rt.usize = rt.usizeRem(n, 19); + if (_4 === 15) { + const part8: rt.u16 | undefined = tryGetU16$bytes_Buf_mut_dyn_bytes_Buf(buf); + const err4: TryGetError.TryGetError | undefined = part8 === undefined ? Pieces.tryGetU16Out$bytes_Buf_mut.err as TryGetError.TryGetError : undefined; + const part9 = result_map$0hs8st9((err4 !== undefined ? rt.Err(err4 as TryGetError.TryGetError) : rt.Ok(part8 as rt.u16)) as rt.Result, (a02: rt.u16): rt.u128 => { + return a02 as rt.u128; + }); + return _3(part9); + } + if (_4 === 16) { + const part6: rt.i64 | undefined = tryGetI64Le$bytes_Buf_mut_dyn_bytes_Buf(buf); + const err3: TryGetError.TryGetError | undefined = part6 === undefined ? Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part7 = result_map$0c3nzkx((err3 !== undefined ? rt.Err(err3 as TryGetError.TryGetError) : rt.Ok(part6 as rt.i64)) as rt.Result, (v2: rt.i64): rt.u128 => { + return rt.u128Cast(v2); + }); + return _3(part7); + } + if (_4 === 17) { + const part5: rt.u128 | undefined = tryGetU128$bytes_Buf_mut_dyn_bytes_Buf(buf); + const err2: TryGetError.TryGetError | undefined = part5 === undefined ? Pieces.tryGetU128Out$bytes_Buf_mut.err as TryGetError.TryGetError : undefined; + const args = [(err2 !== undefined ? rt.Err(err2 as TryGetError.TryGetError) : rt.Ok(part5 as rt.u128)) as rt.Result] as [rt.Result]; + return _3(args[0]); + } + if (_4 === 18) { + const part3: rt.u8 | undefined = tryGetU8$bytes_Buf_mut_dyn_bytes_Buf(buf); + const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { + return a0 as rt.u128; + }); + return _3(part4); + } + if (_4 === 0) { + return getU8$bytes_Buf_mut_dyn_bytes_Buf(buf) as rt.u128; + } + if (_4 === 1) { + return rt.u128Cast(getI8$bytes_Buf_mut_dyn_bytes_Buf(buf)); + } + if (_4 === 2) { + return getU16$bytes_Buf_mut_dyn_bytes_Buf(buf) as rt.u128; + } + if (_4 === 3) { + return rt.u128Cast(getI16Le$bytes_Buf_mut_dyn_bytes_Buf(buf)); + } + if (_4 === 4) { + return getU32Le$bytes_Buf_mut_dyn_bytes_Buf(buf) as rt.u128; + } + if (_4 === 5) { + return rt.u128Cast(getI32$bytes_Buf_mut_dyn_bytes_Buf(buf)); + } + if (_4 === 6) { + return rt.u128Cast(getU64$bytes_Buf_mut_dyn_bytes_Buf(buf)); + } + if (_4 === 7) { + return rt.u128Cast(getI64Le$bytes_Buf_mut_dyn_bytes_Buf(buf)); + } + if (_4 === 8) { + return getU128Le$bytes_Buf_mut_dyn_bytes_Buf(buf); + } + if (_4 === 9) { + return rt.u128Cast(getI128$bytes_Buf_mut_dyn_bytes_Buf(buf)); + } + if (_4 === 10) { + return rt.u128Cast(getUint$bytes_Buf_mut_dyn_bytes_Buf(buf, rt.usizeRem(n, 10))); + } + if (_4 === 11) { + return rt.u128Cast(getIntLe$bytes_Buf_mut_dyn_bytes_Buf(buf, rt.usizeRem(n, 10))); + } + if (_4 === 12) { + return rt.u128Cast(rt.f64ToBits(getF64$bytes_Buf_mut_dyn_bytes_Buf(buf))); + } + if (_4 === 13) { + return rt.f32ToBits(getF32Le$bytes_Buf_mut_dyn_bytes_Buf(buf)) as rt.u128; + } + const dst: Uint8Array = rt.bytes(3); + const part = rt.usizeRem(n, 4); + copyToSlice$bytes_Buf_mut_dyn_bytes_Buf(buf, rt.byteSliceRange(rt.byteSliceFrom(dst), 0, part)); + return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; +} + +/** + * A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes, or a + * `try_get_*`'s error as what it asked for and what remained. + */ export function read$mut_ref_slice_u8(buf: rt.Place>, n: rt.usize): rt.u128 { - const _3: rt.usize = rt.usizeRem(n, 15); - if (_3 === 0) { + const _3: (a0: rt.Result) => rt.u128 = (got: rt.Result): rt.u128 => { + if (got.ok) { + return got.value; + } + const e: TryGetError.TryGetError = got.error; + return rt.u128Or(rt.u128Shl(e.requested as rt.u128, 64), e.available as rt.u128); + }; + const _4: rt.usize = rt.usizeRem(n, 19); + if (_4 === 15) { + const part8: rt.u16 | undefined = tryGetU16$bytes_Buf_mut_ref_slice_u8(buf); + const err4: TryGetError.TryGetError | undefined = part8 === undefined ? Pieces.tryGetU16Out$bytes_Buf_mut.err as TryGetError.TryGetError : undefined; + const part9 = result_map$0hs8st9((err4 !== undefined ? rt.Err(err4 as TryGetError.TryGetError) : rt.Ok(part8 as rt.u16)) as rt.Result, (a02: rt.u16): rt.u128 => { + return a02 as rt.u128; + }); + return _3(part9); + } + if (_4 === 16) { + const part6: rt.i64 | undefined = tryGetI64Le$bytes_Buf_mut_ref_slice_u8(buf); + const err3: TryGetError.TryGetError | undefined = part6 === undefined ? Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part7 = result_map$0c3nzkx((err3 !== undefined ? rt.Err(err3 as TryGetError.TryGetError) : rt.Ok(part6 as rt.i64)) as rt.Result, (v2: rt.i64): rt.u128 => { + return rt.u128Cast(v2); + }); + return _3(part7); + } + if (_4 === 17) { + const part5: rt.u128 | undefined = tryGetU128$bytes_Buf_mut_ref_slice_u8(buf); + const err2: TryGetError.TryGetError | undefined = part5 === undefined ? Pieces.tryGetU128Out$bytes_Buf_mut.err as TryGetError.TryGetError : undefined; + const args = [(err2 !== undefined ? rt.Err(err2 as TryGetError.TryGetError) : rt.Ok(part5 as rt.u128)) as rt.Result] as [rt.Result]; + return _3(args[0]); + } + if (_4 === 18) { + const part3: rt.u8 | undefined = tryGetU8$bytes_Buf_mut_ref_slice_u8(buf); + const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { + return a0 as rt.u128; + }); + return _3(part4); + } + if (_4 === 0) { return getU8$bytes_Buf_mut_ref_slice_u8(buf) as rt.u128; } - if (_3 === 1) { + if (_4 === 1) { return rt.u128Cast(getI8$bytes_Buf_mut_ref_slice_u8(buf)); } - if (_3 === 2) { + if (_4 === 2) { return getU16$bytes_Buf_mut_ref_slice_u8(buf) as rt.u128; } - if (_3 === 3) { + if (_4 === 3) { return rt.u128Cast(getI16Le$bytes_Buf_mut_ref_slice_u8(buf)); } - if (_3 === 4) { + if (_4 === 4) { return getU32Le$bytes_Buf_mut_ref_slice_u8(buf) as rt.u128; } - if (_3 === 5) { + if (_4 === 5) { return rt.u128Cast(getI32$bytes_Buf_mut_ref_slice_u8(buf)); } - if (_3 === 6) { + if (_4 === 6) { return rt.u128Cast(getU64$bytes_Buf_mut_ref_slice_u8(buf)); } - if (_3 === 7) { + if (_4 === 7) { return rt.u128Cast(getI64Le$bytes_Buf_mut_ref_slice_u8(buf)); } - if (_3 === 8) { + if (_4 === 8) { return getU128Le$bytes_Buf_mut_ref_slice_u8(buf); } - if (_3 === 9) { + if (_4 === 9) { return rt.u128Cast(getI128$bytes_Buf_mut_ref_slice_u8(buf)); } - if (_3 === 10) { + if (_4 === 10) { return rt.u128Cast(getUint$bytes_Buf_mut_ref_slice_u8(buf, rt.usizeRem(n, 10))); } - if (_3 === 11) { + if (_4 === 11) { return rt.u128Cast(getIntLe$bytes_Buf_mut_ref_slice_u8(buf, rt.usizeRem(n, 10))); } - if (_3 === 12) { + if (_4 === 12) { return rt.u128Cast(rt.f64ToBits(getF64$bytes_Buf_mut_ref_slice_u8(buf))); } - if (_3 === 13) { + if (_4 === 13) { return rt.f32ToBits(getF32Le$bytes_Buf_mut_ref_slice_u8(buf)) as rt.u128; } const dst: Uint8Array = rt.bytes(3); @@ -337,49 +1233,107 @@ export function read$mut_ref_slice_u8(buf: rt.Place>, n: return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; } -/** A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes. */ +/** + * A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes, or a + * `try_get_*`'s error as what it asked for and what remained. + */ export function read$ref_slice_u8(buf: rt.Place, n: rt.usize): rt.u128 { - const _3: rt.usize = rt.usizeRem(n, 15); - if (_3 === 0) { + const _3: (a0: rt.Result) => rt.u128 = (got: rt.Result): rt.u128 => { + if (got.ok) { + return got.value; + } + const e: TryGetError.TryGetError = got.error; + return rt.u128Or(rt.u128Shl(e.requested as rt.u128, 64), e.available as rt.u128); + }; + const _4: rt.usize = rt.usizeRem(n, 19); + if (_4 === 15) { + const part7 = result_map$0hs8st9(rt.bufTryGet(buf, 2, false, rt.u16FromBeBytes, (p: rt.Place) => ((a010: rt.ByteSlice): rt.usize => { + return a010.length; + })(p.v), (p: rt.Place) => ((a011: rt.ByteSlice): rt.ByteSlice => { + return a011; + })(p.v), (a012: rt.Place, a15: rt.usize): undefined => { + rt.byteSliceAdvance(a012, a15); + }, (a013: rt.Place, a16: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a013, a16); + }), (a014: rt.u16): rt.u128 => { + return a014 as rt.u128; + }); + return _3(part7); + } + if (_4 === 16) { + const part6 = result_map$0c3nzkx(rt.bufTryGet(buf, 8, true, rt.i64FromBeBytes, (p: rt.Place) => ((a06: rt.ByteSlice): rt.usize => { + return a06.length; + })(p.v), (p: rt.Place) => ((a07: rt.ByteSlice): rt.ByteSlice => { + return a07; + })(p.v), (a08: rt.Place, a13: rt.usize): undefined => { + rt.byteSliceAdvance(a08, a13); + }, (a09: rt.Place, a14: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a09, a14); + }), (v2: rt.i64): rt.u128 => { + return rt.u128Cast(v2); + }); + return _3(part6); + } + if (_4 === 17) { + const part5 = rt.bufTryGet(buf, 16, false, rt.u128FromBeBytes, (p: rt.Place) => ((a02: rt.ByteSlice): rt.usize => { + return a02.length; + })(p.v), (p: rt.Place) => ((a03: rt.ByteSlice): rt.ByteSlice => { + return a03; + })(p.v), (a04: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a04, a1); + }, (a05: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a05, a12); + }); + return _3(part5); + } + if (_4 === 18) { + const part3: rt.u8 | undefined = tryGetU8$bytes_Buf_ref_slice_u8(buf); + const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { + return a0 as rt.u128; + }); + return _3(part4); + } + if (_4 === 0) { return ((rt.bytesReadWord(buf, 1, false) as rt.u8)) as rt.u128; } - if (_3 === 1) { + if (_4 === 1) { return rt.u128Cast((rt.bytesReadWord(buf, 1, false) << 24) >> 24 as rt.i8); } - if (_3 === 2) { + if (_4 === 2) { return ((rt.bytesReadWord(buf, 2, false) as rt.u16)) as rt.u128; } - if (_3 === 3) { + if (_4 === 3) { return rt.u128Cast((rt.bytesReadWord(buf, 2, true) << 16) >> 16 as rt.i16); } - if (_3 === 4) { + if (_4 === 4) { return ((rt.bytesReadWord(buf, 4, true) as rt.u32)) as rt.u128; } - if (_3 === 5) { + if (_4 === 5) { return rt.u128Cast((rt.bytesReadWord(buf, 4, false) | 0) as rt.i32); } - if (_3 === 6) { + if (_4 === 6) { return rt.u128Cast(rt.u64FromBeBytes(rt.bytesRead(buf, 8, false))); } - if (_3 === 7) { + if (_4 === 7) { return rt.u128Cast(rt.i64FromBeBytes(rt.bytesRead(buf, 8, true))); } - if (_3 === 8) { + if (_4 === 8) { return rt.u128FromBeBytes(rt.bytesRead(buf, 16, true)); } - if (_3 === 9) { + if (_4 === 9) { return rt.u128Cast(rt.i128FromBeBytes(rt.bytesRead(buf, 16, false))); } - if (_3 === 10) { + if (_4 === 10) { return rt.u128Cast(rt.u64FromBeBytes(rt.bytesReadInt(buf, 8, rt.usizeRem(n, 10), false, false))); } - if (_3 === 11) { + if (_4 === 11) { return rt.u128Cast(rt.i64FromBeBytes(rt.bytesReadInt(buf, 8, rt.usizeRem(n, 10), true, true))); } - if (_3 === 12) { + if (_4 === 12) { return rt.u128Cast(rt.f64ToBits(rt.f64FromBeBytes(rt.bytesRead(buf, 8, false)))); } - if (_3 === 13) { + if (_4 === 13) { return rt.f32ToBits(rt.f32FromBeBytes(rt.bytesRead(buf, 4, true))) as rt.u128; } const dst: Uint8Array = rt.bytes(3); @@ -420,8 +1374,8 @@ export function reserves(dataData: Uint8Array, dataStart: number, dataLen: numbe } /** - * The same reads off a `Bytes`, a `BytesMut`, a `&[u8]`, buffers in pieces, and each - * through the impl forwarding through a `&mut`: each scalar, and what remains. + * The same reads off a `Bytes`, a `BytesMut`, a `&[u8]`, buffers in pieces, a `Take`, and + * each through the impl forwarding through a `&mut`: each scalar, and what remains. */ export function reads(dataData: Uint8Array, dataStart: number, dataLen: number, out: rt.ByteVec): void { let rest!: rt.ByteVec; @@ -432,36 +1386,38 @@ export function reads(dataData: Uint8Array, dataStart: number, dataLen: number, } const input: rt.ByteSlice = new rt.ByteSlice(dataData, dataStart + 2 + mid, dataLen - 2 - mid); const cut: rt.usize = rt.usizeRem(dataData[dataStart + 1] as rt.usize, rt.usizeAdd(input.length, 1)); - const _22: rt.u8 = rt.u8Rem(dataData[dataStart], 8); + const _22: rt.u8 = rt.u8Rem(dataData[dataStart], 9); if (_22 === 0) { let _24: rt.ByteSlice = rt.bytesCopyFromSlice(input); - rest = readAll$bytes_Bytes(rt.place(() => _24, (value7) => _24 = value7), new rt.ByteSlice(dataData, dataStart + 2, mid), read$bytes_Bytes, out); + rest = readAll$bytes_Bytes(rt.place(() => _24, (value7) => _24 = value7), new rt.ByteSlice(dataData, dataStart + 2, mid), out); } else if (_22 === 1) { - rest = readAll$bytes_BytesMut(rt.bytesMutFrom(input), new rt.ByteSlice(dataData, dataStart + 2, mid), read$bytes_BytesMut, out); + rest = readAll$bytes_BytesMut(rt.bytesMutFrom(input), new rt.ByteSlice(dataData, dataStart + 2, mid), out); } else if (_22 === 2) { - rest = readAll$buf_Pieces(Pieces.new(input.data, input.start, input.length, cut), new rt.ByteSlice(dataData, dataStart + 2, mid), readPieces$buf_Pieces, out); + rest = readAll$buf_Pieces(Pieces.new(input.data, input.start, input.length, cut), new rt.ByteSlice(dataData, dataStart + 2, mid), out); } else if (_22 === 3) { - let _33: rt.ByteSlice = rt.byteSliceRange(input, 0); - rest = readAll$ref_slice_u8(rt.place(() => _33, (value6) => _33 = value6), new rt.ByteSlice(dataData, dataStart + 2, mid), read$ref_slice_u8, out); + let _30: rt.ByteSlice = rt.byteSliceRange(input, 0); + rest = readAll$ref_slice_u8(rt.place(() => _30, (value6) => _30 = value6), new rt.ByteSlice(dataData, dataStart + 2, mid), out); } else if (_22 === 4) { - const _37: Provided.Provided = { _0: Pieces.new(input.data, input.start, input.length, cut) }; - rest = readAll$buf_Provided(_37, new rt.ByteSlice(dataData, dataStart + 2, mid), readPieces$buf_Provided, out); + const _33: Provided.Provided = { _0: Pieces.new(input.data, input.start, input.length, cut) }; + rest = readAll$buf_Provided(_33, new rt.ByteSlice(dataData, dataStart + 2, mid), out); } else if (_22 === 5) { - let _42: rt.ByteSlice = rt.bytesCopyFromSlice(input); - let _41: rt.Place = rt.place(() => _42, (value4) => _42 = value4); - rest = readAll$mut_bytes_Bytes(rt.place(() => _41, (value5) => _41 = value5), new rt.ByteSlice(dataData, dataStart + 2, mid), read$mut_bytes_Bytes, out); + let _37: rt.ByteSlice = rt.bytesCopyFromSlice(input); + let _36: rt.Place = rt.place(() => _37, (value4) => _37 = value4); + rest = readAll$mut_bytes_Bytes(rt.place(() => _36, (value5) => _36 = value5), new rt.ByteSlice(dataData, dataStart + 2, mid), out); } else if (_22 === 6) { - let _46: rt.ByteSlice = rt.byteSliceRange(input, 0); - let _45: rt.Place = rt.place(() => _46, (value2) => _46 = value2); - rest = readAll$mut_ref_slice_u8(rt.place(() => _45, (value3) => _45 = value3), new rt.ByteSlice(dataData, dataStart + 2, mid), read$mut_ref_slice_u8, out); + let _40: rt.ByteSlice = rt.byteSliceRange(input, 0); + let _39: rt.Place = rt.place(() => _40, (value2) => _40 = value2); + rest = readAll$mut_ref_slice_u8(rt.place(() => _39, (value3) => _39 = value3), new rt.ByteSlice(dataData, dataStart + 2, mid), out); + } else if (_22 === 7) { + rest = readAll$bytes_buf_Take_bytes_Bytes(buf_impl_take$bytes_Buf_bytes_Bytes(rt.bytesCopyFromSlice(input), cut), new rt.ByteSlice(dataData, dataStart + 2, mid), out); } else { - let _50: Pieces.Pieces = Pieces.new(input.data, input.start, input.length, cut); - rest = readAll$mut_buf_Pieces(rt.place(() => _50, (value) => _50 = value), new rt.ByteSlice(dataData, dataStart + 2, mid), readPieces$mut_buf_Pieces, out); + let _46: Pieces.Pieces = Pieces.new(input.data, input.start, input.length, cut); + rest = readAll$mut_buf_Pieces(rt.place(() => _46, (value) => _46 = value), new rt.ByteSlice(dataData, dataStart + 2, mid), out); } rt.byteVecExtendFromSlice(out, rt.byteVecSlice(rest)); const vec: rt.ByteVec = new rt.ByteVec(); - const _59: Pieces.Pieces = Pieces.new(input.data, input.start, input.length, cut); - rt.byteVecPutBuf(vec, _59, Pieces.hasRemaining$bytes_Buf, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined); + const _54: Pieces.Pieces = Pieces.new(input.data, input.start, input.length, cut); + rt.byteVecPutBuf(vec, _54, Pieces.hasRemaining$bytes_Buf, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined); rt.byteVecExtendFromSlice(out, rt.byteVecSlice(vec)); const slice: rt.ByteSlice = input; rt.byteVecPush(out, slice.length === input.length ? 1 : 0); @@ -470,53 +1426,25 @@ export function reads(dataData: Uint8Array, dataStart: number, dataLen: number, } } -/** - * The reads of `Buf`'s provided methods that translate for a buffer of the crate's own: - * those whose MIR reads no bytes as another type. - */ -export function readPieces$buf_Pieces(buf: Pieces.Pieces, n: rt.usize): rt.u128 { - if (rt.usizeRem(n, 2) === 0) { - return Pieces.getU8$bytes_Buf(buf) as rt.u128; - } - const dst: Uint8Array = rt.bytes(3); - const part = rt.usizeRem(n, 4); - Pieces.copyToSlice$bytes_Buf(buf, rt.byteSliceRange(rt.byteSliceFrom(dst), 0, part)); - return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; -} - -/** - * The reads of `Buf`'s provided methods that translate for a buffer of the crate's own: - * those whose MIR reads no bytes as another type. - */ -export function readPieces$buf_Provided(buf: Provided.Provided, n: rt.usize): rt.u128 { - if (rt.usizeRem(n, 2) === 0) { - return Provided.getU8$bytes_Buf(buf) as rt.u128; - } - const dst: Uint8Array = rt.bytes(3); - const part = rt.usizeRem(n, 4); - Provided.copyToSlice$bytes_Buf(buf, rt.byteSliceRange(rt.byteSliceFrom(dst), 0, part)); - return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; -} - -/** - * The reads of `Buf`'s provided methods that translate for a buffer of the crate's own: - * those whose MIR reads no bytes as another type. - */ -export function readPieces$mut_buf_Pieces(buf: rt.Place, n: rt.usize): rt.u128 { - if (rt.usizeRem(n, 2) === 0) { - return Pieces.getU8$bytes_Buf_mut(buf) as rt.u128; +/** `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. */ +export function readAll$boxed_Box_dyn_bytes_Buf(buf: rt.Place, ops: rt.ByteSlice, out: rt.ByteVec): rt.ByteVec { + for (const op of rt.byteSliceView(ops)) { + if (!(op === 255)) { + rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read$boxed_Box_dyn_bytes_Buf(buf, op as rt.usize)))); + rt.byteVecPush(out, hasRemaining$bytes_Buf_mut_boxed_Box_dyn_bytes_Buf(buf) ? 1 : 0); + } else { + advance$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf, 1); + } } - const dst: Uint8Array = rt.bytes(3); - const part = rt.usizeRem(n, 4); - Pieces.copyToSlice$bytes_Buf_mut(buf, rt.byteSliceRange(rt.byteSliceFrom(dst), 0, part)); - return ((dst[0] << 16) | (dst[1] << 8) | dst[2]) as rt.u128; + const n: rt.usize = remaining$bytes_Buf_mut_boxed_Box_dyn_bytes_Buf(buf); + return rt.byteSliceToByteVec(copyToBytes$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf, n)); } /** `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. */ -export function readAll$buf_Pieces(buf: Pieces.Pieces, ops: rt.ByteSlice, read: (a0: Pieces.Pieces, a1: rt.usize) => rt.u128, out: rt.ByteVec): rt.ByteVec { +export function readAll$buf_Pieces(buf: Pieces.Pieces, ops: rt.ByteSlice, out: rt.ByteVec): rt.ByteVec { for (const op of rt.byteSliceView(ops)) { if (!(op === 255)) { - rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read(buf, op as rt.usize)))); + rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read$buf_Pieces(buf, op as rt.usize)))); rt.byteVecPush(out, Pieces.hasRemaining$bytes_Buf_mut(buf) ? 1 : 0); } else { Pieces.advance$bytes_Buf(buf, 1); @@ -527,10 +1455,10 @@ export function readAll$buf_Pieces(buf: Pieces.Pieces, ops: rt.ByteSlice, read: } /** `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. */ -export function readAll$buf_Provided(buf: Provided.Provided, ops: rt.ByteSlice, read: (a0: Provided.Provided, a1: rt.usize) => rt.u128, out: rt.ByteVec): rt.ByteVec { +export function readAll$buf_Provided(buf: Provided.Provided, ops: rt.ByteSlice, out: rt.ByteVec): rt.ByteVec { for (const op of rt.byteSliceView(ops)) { if (!(op === 255)) { - rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read(buf, op as rt.usize)))); + rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read$buf_Provided(buf, op as rt.usize)))); rt.byteVecPush(out, Provided.hasRemaining$bytes_Buf_mut(buf) ? 1 : 0); } else { Provided.advance$bytes_Buf(buf, 1); @@ -541,10 +1469,10 @@ export function readAll$buf_Provided(buf: Provided.Provided, ops: rt.ByteSlice, } /** `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. */ -export function readAll$bytes_Bytes(buf: rt.Place, ops: rt.ByteSlice, read: (a0: rt.Place, a1: rt.usize) => rt.u128, out: rt.ByteVec): rt.ByteVec { +export function readAll$bytes_Bytes(buf: rt.Place, ops: rt.ByteSlice, out: rt.ByteVec): rt.ByteVec { for (const op of rt.byteSliceView(ops)) { if (!(op === 255)) { - rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read(buf, op as rt.usize)))); + rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read$bytes_Bytes(buf, op as rt.usize)))); rt.byteVecPush(out, hasRemaining$bytes_Buf_mut_bytes_Bytes(buf) ? 1 : 0); } else { rt.bytesAdvance(buf, 1); @@ -555,10 +1483,10 @@ export function readAll$bytes_Bytes(buf: rt.Place, ops: rt.ByteSli } /** `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. */ -export function readAll$bytes_BytesMut(buf: rt.BytesMut, ops: rt.ByteSlice, read: (a0: rt.BytesMut, a1: rt.usize) => rt.u128, out: rt.ByteVec): rt.ByteVec { +export function readAll$bytes_BytesMut(buf: rt.BytesMut, ops: rt.ByteSlice, out: rt.ByteVec): rt.ByteVec { for (const op of rt.byteSliceView(ops)) { if (!(op === 255)) { - rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read(buf, op as rt.usize)))); + rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read$bytes_BytesMut(buf, op as rt.usize)))); rt.byteVecPush(out, hasRemaining$bytes_Buf_mut_bytes_BytesMut(buf) ? 1 : 0); } else { rt.bytesMutAdvance(buf, 1); @@ -569,10 +1497,52 @@ export function readAll$bytes_BytesMut(buf: rt.BytesMut, ops: rt.ByteSlice, read } /** `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. */ -export function readAll$mut_buf_Pieces(buf: rt.Place, ops: rt.ByteSlice, read: (a0: rt.Place, a1: rt.usize) => rt.u128, out: rt.ByteVec): rt.ByteVec { +export function readAll$bytes_buf_Take_bytes_Bytes(buf: Take.Take, ops: rt.ByteSlice, out: rt.ByteVec): rt.ByteVec { + for (const op of rt.byteSliceView(ops)) { + if (!(op === 255)) { + rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read$bytes_buf_Take_bytes_Bytes(buf, op as rt.usize)))); + rt.byteVecPush(out, Take.hasRemaining$bytes_Buf_mut_bytes_Bytes(buf) ? 1 : 0); + } else { + Take.advance$bytes_Buf_bytes_Bytes(buf, 1); + } + } + const n: rt.usize = Take.remaining$bytes_Buf_mut_bytes_Bytes(buf); + return rt.byteSliceToByteVec(Take.copyToBytes$bytes_Buf_bytes_Bytes(buf, n)); +} + +/** `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. */ +export function readAll$dyn_buf_Leased(buf: Leased.Leased, ops: rt.ByteSlice, out: rt.ByteVec): rt.ByteVec { + for (const op of rt.byteSliceView(ops)) { + if (!(op === 255)) { + rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read$dyn_buf_Leased(buf, op as rt.usize)))); + rt.byteVecPush(out, hasRemaining$bytes_Buf_mut_dyn_buf_Leased(buf) ? 1 : 0); + } else { + buf.advance$Buf(1); + } + } + const n: rt.usize = remaining$bytes_Buf_mut_dyn_buf_Leased(buf); + return rt.byteSliceToByteVec(buf.copyToBytes$Buf(n)); +} + +/** `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. */ +export function readAll$dyn_bytes_Buf(buf: Buf.Buf, ops: rt.ByteSlice, out: rt.ByteVec): rt.ByteVec { + for (const op of rt.byteSliceView(ops)) { + if (!(op === 255)) { + rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read$dyn_bytes_Buf(buf, op as rt.usize)))); + rt.byteVecPush(out, hasRemaining$bytes_Buf_mut_dyn_bytes_Buf(buf) ? 1 : 0); + } else { + buf.advance$Buf(1); + } + } + const n: rt.usize = remaining$bytes_Buf_mut_dyn_bytes_Buf(buf); + return rt.byteSliceToByteVec(buf.copyToBytes$Buf(n)); +} + +/** `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. */ +export function readAll$mut_buf_Pieces(buf: rt.Place, ops: rt.ByteSlice, out: rt.ByteVec): rt.ByteVec { for (const op of rt.byteSliceView(ops)) { if (!(op === 255)) { - rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read(buf, op as rt.usize)))); + rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read$mut_buf_Pieces(buf, op as rt.usize)))); rt.byteVecPush(out, Pieces.hasRemaining$bytes_Buf_mut_mut(buf) ? 1 : 0); } else { Pieces.advance$bytes_Buf_mut(buf, 1); @@ -583,10 +1553,10 @@ export function readAll$mut_buf_Pieces(buf: rt.Place, ops: rt.Byt } /** `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. */ -export function readAll$mut_bytes_Bytes(buf: rt.Place>, ops: rt.ByteSlice, read: (a0: rt.Place>, a1: rt.usize) => rt.u128, out: rt.ByteVec): rt.ByteVec { +export function readAll$mut_bytes_Bytes(buf: rt.Place>, ops: rt.ByteSlice, out: rt.ByteVec): rt.ByteVec { for (const op of rt.byteSliceView(ops)) { if (!(op === 255)) { - rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read(buf, op as rt.usize)))); + rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read$mut_bytes_Bytes(buf, op as rt.usize)))); rt.byteVecPush(out, hasRemaining$bytes_Buf_mut_mut_bytes_Bytes(buf) ? 1 : 0); } else { advance$bytes_Buf_mut_bytes_Bytes(buf, 1); @@ -597,10 +1567,24 @@ export function readAll$mut_bytes_Bytes(buf: rt.Place>, o } /** `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. */ -export function readAll$mut_ref_slice_u8(buf: rt.Place>, ops: rt.ByteSlice, read: (a0: rt.Place>, a1: rt.usize) => rt.u128, out: rt.ByteVec): rt.ByteVec { +export function readAll$mut_dyn_bytes_Buf(buf: rt.Place, ops: rt.ByteSlice, out: rt.ByteVec): rt.ByteVec { for (const op of rt.byteSliceView(ops)) { if (!(op === 255)) { - rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read(buf, op as rt.usize)))); + rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read$mut_dyn_bytes_Buf(buf, op as rt.usize)))); + rt.byteVecPush(out, hasRemaining$bytes_Buf_mut_mut_dyn_bytes_Buf(buf) ? 1 : 0); + } else { + advance$bytes_Buf_mut_dyn_bytes_Buf(buf, 1); + } + } + const n: rt.usize = remaining$bytes_Buf_mut_mut_dyn_bytes_Buf(buf); + return rt.byteSliceToByteVec(copyToBytes$bytes_Buf_mut_dyn_bytes_Buf(buf, n)); +} + +/** `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. */ +export function readAll$mut_ref_slice_u8(buf: rt.Place>, ops: rt.ByteSlice, out: rt.ByteVec): rt.ByteVec { + for (const op of rt.byteSliceView(ops)) { + if (!(op === 255)) { + rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read$mut_ref_slice_u8(buf, op as rt.usize)))); rt.byteVecPush(out, hasRemaining$bytes_Buf_mut_mut_ref_slice_u8(buf) ? 1 : 0); } else { advance$bytes_Buf_mut_ref_slice_u8(buf, 1); @@ -611,10 +1595,10 @@ export function readAll$mut_ref_slice_u8(buf: rt.Place>, } /** `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. */ -export function readAll$ref_slice_u8(buf: rt.Place, ops: rt.ByteSlice, read: (a0: rt.Place, a1: rt.usize) => rt.u128, out: rt.ByteVec): rt.ByteVec { +export function readAll$ref_slice_u8(buf: rt.Place, ops: rt.ByteSlice, out: rt.ByteVec): rt.ByteVec { for (const op of rt.byteSliceView(ops)) { if (!(op === 255)) { - rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read(buf, op as rt.usize)))); + rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(read$ref_slice_u8(buf, op as rt.usize)))); rt.byteVecPush(out, hasRemaining$bytes_Buf_mut_ref_slice_u8(buf) ? 1 : 0); } else { rt.byteSliceAdvance(buf, 1); @@ -624,6 +1608,75 @@ export function readAll$ref_slice_u8(buf: rt.Place, ops: rt.ByteSl return rt.byteSliceToByteVec(rt.byteSliceCopyToBytes(buf, n)); } +/** + * The reads of `reads` through a `dyn Buf` of each buffer: called on the object, through + * the impls forwarding through a `&mut` to one and a `Box` of one, and through the crate's + * own trait over `Buf`. A box drops what it owns once. + */ +export function dyns(dataData: Uint8Array, dataStart: number, dataLen: number, out: rt.ByteVec): void { + let _30!: Buf.Buf; + let rest!: rt.ByteVec; + let _58!: Buf.Buf; + if (dataLen >= 2) { + const mid: number = rt.usizeDiv(dataLen - 2, 2); + if (mid > dataLen - 2) { + rt.panic("mid > len"); + } + const ops2: rt.ByteSlice = new rt.ByteSlice(dataData, dataStart + 2, mid); + const input: rt.ByteSlice = new rt.ByteSlice(dataData, dataStart + 2 + mid, dataLen - 2 - mid); + const cut: rt.usize = rt.usizeRem(dataData[dataStart + 1] as rt.usize, rt.usizeAdd(input.length, 1)); + let bytes: rt.ByteSlice = rt.bytesCopyFromSlice(input); + const owned: rt.BytesMut = rt.bytesMutFrom(input); + let slice: rt.ByteSlice = input; + const pieces: Pieces.Pieces = Pieces.new(input.data, input.start, input.length, cut); + const provided: Provided.Provided = { _0: Pieces.new(input.data, input.start, input.length, cut) }; + const take: Take.Take = buf_impl_take$bytes_Buf_bytes_Bytes(rt.bytesCopyFromSlice(input), cut); + const _31: rt.u8 = rt.u8Rem(dataData[dataStart], 6); + if (_31 === 0) { + _30 = new Buf.ofPlace$bytes_Bytes(rt.place(() => bytes, (value2) => bytes = value2)); + } else if (_31 === 1) { + _30 = new Buf.of$bytes_BytesMut(owned); + } else if (_31 === 2) { + _30 = new Buf.ofPlace$ref_slice_u8(rt.place(() => slice, (value) => slice = value)); + } else if (_31 === 3) { + _30 = new Buf.of$buf_Pieces(pieces); + } else if (_31 === 4) { + _30 = new Buf.of$buf_Provided(provided); + } else { + _30 = new Buf.of$bytes_buf_Take_bytes_Bytes(take); + } + const buf: Buf.Buf = _30; + if (rt.u8Rem(rt.u8Div(dataData[dataStart], 6), 3) === 0) { + rest = readAll$dyn_bytes_Buf(buf, ops2, out); + } else { + let _43: Buf.Buf = buf; + rest = readAll$mut_dyn_bytes_Buf(rt.place(() => _43, (value3) => _43 = value3), ops2, out); + } + rt.byteVecExtendFromSlice(out, rt.byteVecSlice(rest)); + rt.byteVecPush(out, bytes.length & 0xff); + rt.byteVecPush(out, slice.length & 0xff); + const drops: rt.Arc> = new rt.Arc(new rt.Cell(0)); + const _59: rt.u8 = rt.u8Rem(dataData[dataStart], 3); + if (_59 === 0) { + _58 = new Buf.of$buf_Counted(new Counted.Counted(Pieces.new(input.data, input.start, input.length, cut), rt.arcClone(drops))); + } else if (_59 === 1) { + _58 = new Buf.of$bytes_Bytes(rt.bytesCopyFromSlice(input)); + } else { + _58 = new Buf.of$ref_slice_u8(rt.byteSliceRange(input, 0)); + } + let boxed: Buf.Buf = _58; + rt.byteVecExtendFromSlice(out, rt.byteVecSlice(readAll$boxed_Box_dyn_bytes_Buf(rt.place(() => boxed, (value4) => boxed = value4), ops2, out))); + rt.drop(boxed); + rt.byteVecPush(out, drops.value.v); + const leased: Leased.Leased = new Leased.of$buf_Pieces(Pieces.new(input.data, input.start, input.length, cut)); + rt.byteVecPush(out, leased.pieces$Leased() & 0xff); + rt.byteVecExtendFromSlice(out, rt.byteVecSlice(readAll$dyn_buf_Leased(leased, ops2, out))); + rt.byteVecPush(out, leased.pieces$Leased() & 0xff); + rt.drop(leased); + drops[Symbol.dispose](); + } +} + /** * The same writes into a `Vec` and a `BytesMut`, which must match, and through the * impls forwarding through a `&mut` and a `Box`, whose provided `put` and `put_bytes` diff --git a/ts/fixtures/stock/expected/bytes.ts b/ts/fixtures/stock/expected/bytes.ts index c3d0f172b..26d89855f 100644 --- a/ts/fixtures/stock/expected/bytes.ts +++ b/ts/fixtures/stock/expected/bytes.ts @@ -11,4 +11,9 @@ export function panicAdvance(errorInfo: TryGetError.TryGetError): never { rt.panicFmt(["advance out of bounds: the len is ", args2[0], " but advancing by ", args2[1]]); } +export function panicDoesNotFit(size: rt.usize, nbytes: rt.usize): never { + const args2: rt.Fmt[] = [(f: rt.Formatter) => rt.usizeDisplay(size, f), (f: rt.Formatter) => rt.usizeDisplay(nbytes, f)]; + rt.panicFmt(["size too large: the integer type can fit ", args2[0], " bytes, but nbytes is ", args2[1]]); +} + //# sourceMappingURL=bytes.ts.map diff --git a/ts/fixtures/stock/expected/bytes/buf/buf_impl.Buf.ts b/ts/fixtures/stock/expected/bytes/buf/buf_impl.Buf.ts new file mode 100644 index 000000000..416ce9f50 --- /dev/null +++ b/ts/fixtures/stock/expected/bytes/buf/buf_impl.Buf.ts @@ -0,0 +1,4316 @@ +// Generated by rust2-ts. Do not edit. + +import * as rt from "../../rt.ts"; +import * as Counted from "../../buf.Counted.ts"; +import * as Pieces from "../../buf.Pieces.ts"; +import * as Provided from "../../buf.Provided.ts"; +import { tryCopyToSlice$bytes_Buf_bytes_Bytes, tryCopyToSlice$bytes_Buf_bytes_BytesMut, tryCopyToSlice$bytes_Buf_ref_slice_u8, tryGetU8$bytes_Buf_bytes_Bytes, tryGetU8$bytes_Buf_bytes_BytesMut, tryGetU8$bytes_Buf_ref_slice_u8, tryGetI8$bytes_Buf_bytes_Bytes, tryGetI8$bytes_Buf_bytes_BytesMut, tryGetI8$bytes_Buf_ref_slice_u8, tryGetUint$bytes_Buf_bytes_Bytes, tryGetUint$bytes_Buf_bytes_BytesMut, tryGetUint$bytes_Buf_ref_slice_u8, tryGetUintLe$bytes_Buf_bytes_Bytes, tryGetUintLe$bytes_Buf_bytes_BytesMut, tryGetUintLe$bytes_Buf_ref_slice_u8, tryGetUintNe$bytes_Buf_bytes_Bytes, tryGetUintNe$bytes_Buf_bytes_BytesMut, tryGetUintNe$bytes_Buf_ref_slice_u8, tryGetInt$bytes_Buf_bytes_Bytes, tryGetInt$bytes_Buf_bytes_BytesMut, tryGetInt$bytes_Buf_ref_slice_u8, tryGetIntLe$bytes_Buf_bytes_Bytes, tryGetIntLe$bytes_Buf_bytes_BytesMut, tryGetIntLe$bytes_Buf_ref_slice_u8, tryGetIntNe$bytes_Buf_bytes_Bytes, tryGetIntNe$bytes_Buf_bytes_BytesMut, tryGetIntNe$bytes_Buf_ref_slice_u8, tryGetF32$bytes_Buf_bytes_Bytes, tryGetF32$bytes_Buf_bytes_BytesMut, tryGetF32$bytes_Buf_ref_slice_u8, tryGetF32Le$bytes_Buf_bytes_Bytes, tryGetF32Le$bytes_Buf_bytes_BytesMut, tryGetF32Le$bytes_Buf_ref_slice_u8, tryGetF32Ne$bytes_Buf_bytes_Bytes, tryGetF32Ne$bytes_Buf_bytes_BytesMut, tryGetF32Ne$bytes_Buf_ref_slice_u8, tryGetF64$bytes_Buf_bytes_Bytes, tryGetF64$bytes_Buf_bytes_BytesMut, tryGetF64$bytes_Buf_ref_slice_u8, tryGetF64Le$bytes_Buf_bytes_Bytes, tryGetF64Le$bytes_Buf_bytes_BytesMut, tryGetF64Le$bytes_Buf_ref_slice_u8, tryGetF64Ne$bytes_Buf_bytes_Bytes, tryGetF64Ne$bytes_Buf_bytes_BytesMut, tryGetF64Ne$bytes_Buf_ref_slice_u8 } from "../../bytes/buf/buf_impl.ts"; +import * as Take from "../../bytes/buf/take.Take.ts"; +import type * as TryGetError from "../../bytes.TryGetError.ts"; + +/** + * Read bytes from a buffer. + * + * A buffer stores bytes in memory such that read operations are infallible. + * The underlying storage may or may not be in contiguous memory. A `Buf` value + * is a cursor into the buffer. Reading from `Buf` advances the cursor + * position. It can be thought of as an efficient `Iterator` for collections of + * bytes. + * + * The simplest `Buf` is a `&[u8]`. + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(b'h', buf.get_u8()); + * assert_eq!(b'e', buf.get_u8()); + * assert_eq!(b'l', buf.get_u8()); + * + * let mut rest = [0; 8]; + * buf.copy_to_slice(&mut rest); + * + * assert_eq!(&rest[..], &b"lo world"[..]); + * ``` + */ +export type Buf = + | { remaining$Buf: () => rt.usize; chunk$Buf: () => rt.ByteSlice; advance$Buf: (a0: rt.usize) => void; hasRemaining$Buf: () => boolean; copyToSlice$Buf: (a0: rt.ByteSlice) => void; getU8$Buf: () => rt.u8; getI8$Buf: () => rt.i8; getU16$Buf: () => rt.u16; getU16Le$Buf: () => rt.u16; getU16Ne$Buf: () => rt.u16; getI16$Buf: () => rt.i16; getI16Le$Buf: () => rt.i16; getI16Ne$Buf: () => rt.i16; getU32$Buf: () => rt.u32; getU32Le$Buf: () => rt.u32; getU32Ne$Buf: () => rt.u32; getI32$Buf: () => rt.i32; getI32Le$Buf: () => rt.i32; getI32Ne$Buf: () => rt.i32; getU64$Buf: () => rt.u64; getU64Le$Buf: () => rt.u64; getU64Ne$Buf: () => rt.u64; getI64$Buf: () => rt.i64; getI64Le$Buf: () => rt.i64; getI64Ne$Buf: () => rt.i64; getU128$Buf: () => rt.u128; getU128Le$Buf: () => rt.u128; getU128Ne$Buf: () => rt.u128; getI128$Buf: () => rt.i128; getI128Le$Buf: () => rt.i128; getI128Ne$Buf: () => rt.i128; getUint$Buf: (a0: rt.usize) => rt.u64; getUintLe$Buf: (a0: rt.usize) => rt.u64; getUintNe$Buf: (a0: rt.usize) => rt.u64; getInt$Buf: (a0: rt.usize) => rt.i64; getIntLe$Buf: (a0: rt.usize) => rt.i64; getIntNe$Buf: (a0: rt.usize) => rt.i64; getF32$Buf: () => rt.f32; getF32Le$Buf: () => rt.f32; getF32Ne$Buf: () => rt.f32; getF64$Buf: () => rt.f64; getF64Le$Buf: () => rt.f64; getF64Ne$Buf: () => rt.f64; tryCopyToSlice$Buf: (a0: rt.ByteSlice) => rt.Result; tryGetU8$Buf: () => rt.Result; tryGetI8$Buf: () => rt.Result; tryGetU16$Buf: () => rt.Result; tryGetU16Le$Buf: () => rt.Result; tryGetU16Ne$Buf: () => rt.Result; tryGetI16$Buf: () => rt.Result; tryGetI16Le$Buf: () => rt.Result; tryGetI16Ne$Buf: () => rt.Result; tryGetU32$Buf: () => rt.Result; tryGetU32Le$Buf: () => rt.Result; tryGetU32Ne$Buf: () => rt.Result; tryGetI32$Buf: () => rt.Result; tryGetI32Le$Buf: () => rt.Result; tryGetI32Ne$Buf: () => rt.Result; tryGetU64$Buf: () => rt.Result; tryGetU64Le$Buf: () => rt.Result; tryGetU64Ne$Buf: () => rt.Result; tryGetI64$Buf: () => rt.Result; tryGetI64Le$Buf: () => rt.Result; tryGetI64Ne$Buf: () => rt.Result; tryGetU128$Buf: () => rt.Result; tryGetU128Le$Buf: () => rt.Result; tryGetU128Ne$Buf: () => rt.Result; tryGetI128$Buf: () => rt.Result; tryGetI128Le$Buf: () => rt.Result; tryGetI128Ne$Buf: () => rt.Result; tryGetUint$Buf: (a0: rt.usize) => rt.Result; tryGetUintLe$Buf: (a0: rt.usize) => rt.Result; tryGetUintNe$Buf: (a0: rt.usize) => rt.Result; tryGetInt$Buf: (a0: rt.usize) => rt.Result; tryGetIntLe$Buf: (a0: rt.usize) => rt.Result; tryGetIntNe$Buf: (a0: rt.usize) => rt.Result; tryGetF32$Buf: () => rt.Result; tryGetF32Le$Buf: () => rt.Result; tryGetF32Ne$Buf: () => rt.Result; tryGetF64$Buf: () => rt.Result; tryGetF64Le$Buf: () => rt.Result; tryGetF64Ne$Buf: () => rt.Result; copyToBytes$Buf: (a0: rt.usize) => rt.ByteSlice }; + +export class of$buf_Counted { + v: Counted.Counted; + + constructor(v: Counted.Counted) { + this.v = v; + } + + [Symbol.dispose](): void { + this.v[Symbol.dispose](); + } + + advance$Buf(a: rt.usize): void { + return Counted.advance$bytes_Buf(this.v, a); + } + + chunk$Buf(): rt.ByteSlice { + return Counted.chunk$bytes_Buf(this.v); + } + + copyToBytes$Buf(a: rt.usize): rt.ByteSlice { + return rt.bufCopyToBytes(this.v, a, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined); + } + + copyToSlice$Buf(a: rt.ByteSlice): void { + return Counted.copyToSlice$bytes_Buf(this.v, a); + } + + getF32$Buf(): rt.f32 { + return Counted.getF32$bytes_Buf(this.v); + } + + getF32Le$Buf(): rt.f32 { + return Counted.getF32Le$bytes_Buf(this.v); + } + + getF32Ne$Buf(): rt.f32 { + return Counted.getF32Ne$bytes_Buf(this.v); + } + + getF64$Buf(): rt.f64 { + return Counted.getF64$bytes_Buf(this.v); + } + + getF64Le$Buf(): rt.f64 { + return Counted.getF64Le$bytes_Buf(this.v); + } + + getF64Ne$Buf(): rt.f64 { + return Counted.getF64Ne$bytes_Buf(this.v); + } + + getI128$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, false, rt.i128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getI128Le$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, true, rt.i128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getI128Ne$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, true, rt.i128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getI16$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, false, rt.i16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getI16Le$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, true, rt.i16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getI16Ne$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, true, rt.i16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getI32$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, false, rt.i32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getI32Le$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, true, rt.i32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getI32Ne$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, true, rt.i32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getI64$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, false, rt.i64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getI64Le$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, true, rt.i64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getI64Ne$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, true, rt.i64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getI8$Buf(): rt.i8 { + return Counted.getI8$bytes_Buf(this.v); + } + + getInt$Buf(a: rt.usize): rt.i64 { + return Counted.getInt$bytes_Buf(this.v, a); + } + + getIntLe$Buf(a: rt.usize): rt.i64 { + return Counted.getIntLe$bytes_Buf(this.v, a); + } + + getIntNe$Buf(a: rt.usize): rt.i64 { + return Counted.getIntNe$bytes_Buf(this.v, a); + } + + getU128$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, false, rt.u128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getU128Le$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, true, rt.u128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getU128Ne$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, true, rt.u128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getU16$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, false, rt.u16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getU16Le$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, true, rt.u16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getU16Ne$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, true, rt.u16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getU32$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, false, rt.u32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getU32Le$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, true, rt.u32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getU32Ne$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, true, rt.u32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getU64$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, false, rt.u64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getU64Le$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, true, rt.u64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getU64Ne$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, true, rt.u64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + getU8$Buf(): rt.u8 { + return Counted.getU8$bytes_Buf(this.v); + } + + getUint$Buf(a: rt.usize): rt.u64 { + return Counted.getUint$bytes_Buf(this.v, a); + } + + getUintLe$Buf(a: rt.usize): rt.u64 { + return Counted.getUintLe$bytes_Buf(this.v, a); + } + + getUintNe$Buf(a: rt.usize): rt.u64 { + return Counted.getUintNe$bytes_Buf(this.v, a); + } + + hasRemaining$Buf(): boolean { + return Counted.hasRemaining$bytes_Buf(this.v); + } + + remaining$Buf(): rt.usize { + return Counted.remaining$bytes_Buf(this.v); + } + + tryCopyToSlice$Buf(a: rt.ByteSlice): rt.Result { + return Counted.tryCopyToSlice$bytes_Buf(this.v, a); + } + + tryGetF32$Buf(): rt.Result { + const part = Counted.tryGetF32$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Le$Buf(): rt.Result { + const part = Counted.tryGetF32Le$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Ne$Buf(): rt.Result { + const part = Counted.tryGetF32Ne$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64$Buf(): rt.Result { + const part = Counted.tryGetF64$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Le$Buf(): rt.Result { + const part = Counted.tryGetF64Le$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Ne$Buf(): rt.Result { + const part = Counted.tryGetF64Ne$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetI128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.i128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetI128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetI128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetI16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.i16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetI16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetI16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetI32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.i32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetI32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetI32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetI64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.i64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetI64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetI64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetI8$Buf(): rt.Result { + const part = Counted.tryGetI8$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetInt$Buf(a: rt.usize): rt.Result { + const part = Counted.tryGetInt$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntLe$Buf(a: rt.usize): rt.Result { + const part = Counted.tryGetIntLe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntNe$Buf(a: rt.usize): rt.Result { + const part = Counted.tryGetIntNe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetU128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.u128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetU128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetU128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetU16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.u16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetU16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetU16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetU32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.u32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetU32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetU32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetU64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.u64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetU64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetU64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + } + + tryGetU8$Buf(): rt.Result { + const part = Counted.tryGetU8$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUint$Buf(a: rt.usize): rt.Result { + const part = Counted.tryGetUint$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintLe$Buf(a: rt.usize): rt.Result { + const part = Counted.tryGetUintLe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintNe$Buf(a: rt.usize): rt.Result { + const part = Counted.tryGetUintNe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } +} + +export class of$buf_Pieces { + v: Pieces.Pieces; + + constructor(v: Pieces.Pieces) { + this.v = v; + } + + advance$Buf(a: rt.usize): void { + return Pieces.advance$bytes_Buf(this.v, a); + } + + chunk$Buf(): rt.ByteSlice { + return Pieces.chunk$bytes_Buf(this.v); + } + + copyToBytes$Buf(a: rt.usize): rt.ByteSlice { + return Pieces.copyToBytes$bytes_Buf(this.v, a); + } + + copyToSlice$Buf(a: rt.ByteSlice): void { + return Pieces.copyToSlice$bytes_Buf(this.v, a); + } + + getF32$Buf(): rt.f32 { + return Pieces.getF32$bytes_Buf(this.v); + } + + getF32Le$Buf(): rt.f32 { + return Pieces.getF32Le$bytes_Buf(this.v); + } + + getF32Ne$Buf(): rt.f32 { + return Pieces.getF32Ne$bytes_Buf(this.v); + } + + getF64$Buf(): rt.f64 { + return Pieces.getF64$bytes_Buf(this.v); + } + + getF64Le$Buf(): rt.f64 { + return Pieces.getF64Le$bytes_Buf(this.v); + } + + getF64Ne$Buf(): rt.f64 { + return Pieces.getF64Ne$bytes_Buf(this.v); + } + + getI128$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, false, rt.i128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI128Le$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, true, rt.i128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI128Ne$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, true, rt.i128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI16$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, false, rt.i16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI16Le$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, true, rt.i16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI16Ne$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, true, rt.i16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI32$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, false, rt.i32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI32Le$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, true, rt.i32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI32Ne$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, true, rt.i32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI64$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, false, rt.i64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI64Le$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, true, rt.i64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI64Ne$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, true, rt.i64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getI8$Buf(): rt.i8 { + return Pieces.getI8$bytes_Buf(this.v); + } + + getInt$Buf(a: rt.usize): rt.i64 { + return Pieces.getInt$bytes_Buf(this.v, a); + } + + getIntLe$Buf(a: rt.usize): rt.i64 { + return Pieces.getIntLe$bytes_Buf(this.v, a); + } + + getIntNe$Buf(a: rt.usize): rt.i64 { + return Pieces.getIntNe$bytes_Buf(this.v, a); + } + + getU128$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, false, rt.u128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU128Le$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, true, rt.u128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU128Ne$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, true, rt.u128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU16$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, false, rt.u16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU16Le$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, true, rt.u16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU16Ne$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, true, rt.u16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU32$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, false, rt.u32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU32Le$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, true, rt.u32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU32Ne$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, true, rt.u32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU64$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, false, rt.u64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU64Le$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, true, rt.u64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU64Ne$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, true, rt.u64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + getU8$Buf(): rt.u8 { + return Pieces.getU8$bytes_Buf(this.v); + } + + getUint$Buf(a: rt.usize): rt.u64 { + return Pieces.getUint$bytes_Buf(this.v, a); + } + + getUintLe$Buf(a: rt.usize): rt.u64 { + return Pieces.getUintLe$bytes_Buf(this.v, a); + } + + getUintNe$Buf(a: rt.usize): rt.u64 { + return Pieces.getUintNe$bytes_Buf(this.v, a); + } + + hasRemaining$Buf(): boolean { + return Pieces.hasRemaining$bytes_Buf(this.v); + } + + remaining$Buf(): rt.usize { + return Pieces.remaining$bytes_Buf(this.v); + } + + tryCopyToSlice$Buf(a: rt.ByteSlice): rt.Result { + return Pieces.tryCopyToSlice$bytes_Buf(this.v, a); + } + + tryGetF32$Buf(): rt.Result { + const part = Pieces.tryGetF32$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Le$Buf(): rt.Result { + const part = Pieces.tryGetF32Le$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Ne$Buf(): rt.Result { + const part = Pieces.tryGetF32Ne$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64$Buf(): rt.Result { + const part = Pieces.tryGetF64$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Le$Buf(): rt.Result { + const part = Pieces.tryGetF64Le$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Ne$Buf(): rt.Result { + const part = Pieces.tryGetF64Ne$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetI128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.i128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.i16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.i32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.i64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetI8$Buf(): rt.Result { + const part = Pieces.tryGetI8$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetInt$Buf(a: rt.usize): rt.Result { + const part = Pieces.tryGetInt$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntLe$Buf(a: rt.usize): rt.Result { + const part = Pieces.tryGetIntLe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntNe$Buf(a: rt.usize): rt.Result { + const part = Pieces.tryGetIntNe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetU128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.u128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.u16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.u32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.u64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, Pieces.remaining$bytes_Buf, Pieces.chunk$bytes_Buf, Pieces.advance$bytes_Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined, Pieces.copyToSlice$bytes_Buf as (a0: Pieces.Pieces, a1: rt.ByteSlice) => undefined); + } + + tryGetU8$Buf(): rt.Result { + const part = Pieces.tryGetU8$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUint$Buf(a: rt.usize): rt.Result { + const part = Pieces.tryGetUint$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintLe$Buf(a: rt.usize): rt.Result { + const part = Pieces.tryGetUintLe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintNe$Buf(a: rt.usize): rt.Result { + const part = Pieces.tryGetUintNe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } +} + +export class of$buf_Provided { + v: Provided.Provided; + + constructor(v: Provided.Provided) { + this.v = v; + } + + advance$Buf(a: rt.usize): void { + return Provided.advance$bytes_Buf(this.v, a); + } + + chunk$Buf(): rt.ByteSlice { + return Provided.chunk$bytes_Buf(this.v); + } + + copyToBytes$Buf(a: rt.usize): rt.ByteSlice { + return rt.bufCopyToBytes(this.v, a, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined); + } + + copyToSlice$Buf(a: rt.ByteSlice): void { + return Provided.copyToSlice$bytes_Buf(this.v, a); + } + + getF32$Buf(): rt.f32 { + return Provided.getF32$bytes_Buf(this.v); + } + + getF32Le$Buf(): rt.f32 { + return Provided.getF32Le$bytes_Buf(this.v); + } + + getF32Ne$Buf(): rt.f32 { + return Provided.getF32Ne$bytes_Buf(this.v); + } + + getF64$Buf(): rt.f64 { + return Provided.getF64$bytes_Buf(this.v); + } + + getF64Le$Buf(): rt.f64 { + return Provided.getF64Le$bytes_Buf(this.v); + } + + getF64Ne$Buf(): rt.f64 { + return Provided.getF64Ne$bytes_Buf(this.v); + } + + getI128$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, false, rt.i128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getI128Le$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, true, rt.i128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getI128Ne$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, true, rt.i128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getI16$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, false, rt.i16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getI16Le$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, true, rt.i16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getI16Ne$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, true, rt.i16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getI32$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, false, rt.i32FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getI32Le$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, true, rt.i32FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getI32Ne$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, true, rt.i32FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getI64$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, false, rt.i64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getI64Le$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, true, rt.i64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getI64Ne$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, true, rt.i64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getI8$Buf(): rt.i8 { + return Provided.getI8$bytes_Buf(this.v); + } + + getInt$Buf(a: rt.usize): rt.i64 { + return Provided.getInt$bytes_Buf(this.v, a); + } + + getIntLe$Buf(a: rt.usize): rt.i64 { + return Provided.getIntLe$bytes_Buf(this.v, a); + } + + getIntNe$Buf(a: rt.usize): rt.i64 { + return Provided.getIntNe$bytes_Buf(this.v, a); + } + + getU128$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, false, rt.u128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getU128Le$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, true, rt.u128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getU128Ne$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, true, rt.u128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getU16$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, false, rt.u16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getU16Le$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, true, rt.u16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getU16Ne$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, true, rt.u16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getU32$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, false, rt.u32FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getU32Le$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, true, rt.u32FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getU32Ne$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, true, rt.u32FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getU64$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, false, rt.u64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getU64Le$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, true, rt.u64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getU64Ne$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, true, rt.u64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + getU8$Buf(): rt.u8 { + return Provided.getU8$bytes_Buf(this.v); + } + + getUint$Buf(a: rt.usize): rt.u64 { + return Provided.getUint$bytes_Buf(this.v, a); + } + + getUintLe$Buf(a: rt.usize): rt.u64 { + return Provided.getUintLe$bytes_Buf(this.v, a); + } + + getUintNe$Buf(a: rt.usize): rt.u64 { + return Provided.getUintNe$bytes_Buf(this.v, a); + } + + hasRemaining$Buf(): boolean { + return Provided.hasRemaining$bytes_Buf(this.v); + } + + remaining$Buf(): rt.usize { + return Provided.remaining$bytes_Buf(this.v); + } + + tryCopyToSlice$Buf(a: rt.ByteSlice): rt.Result { + return Provided.tryCopyToSlice$bytes_Buf(this.v, a); + } + + tryGetF32$Buf(): rt.Result { + const part = Provided.tryGetF32$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Le$Buf(): rt.Result { + const part = Provided.tryGetF32Le$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Ne$Buf(): rt.Result { + const part = Provided.tryGetF32Ne$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64$Buf(): rt.Result { + const part = Provided.tryGetF64$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Le$Buf(): rt.Result { + const part = Provided.tryGetF64Le$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Ne$Buf(): rt.Result { + const part = Provided.tryGetF64Ne$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetI128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.i128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetI128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetI128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetI16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.i16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetI16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetI16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetI32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.i32FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetI32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetI32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetI64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.i64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetI64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetI64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetI8$Buf(): rt.Result { + const part = Provided.tryGetI8$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetInt$Buf(a: rt.usize): rt.Result { + const part = Provided.tryGetInt$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntLe$Buf(a: rt.usize): rt.Result { + const part = Provided.tryGetIntLe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntNe$Buf(a: rt.usize): rt.Result { + const part = Provided.tryGetIntNe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetU128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.u128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetU128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetU128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetU16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.u16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetU16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetU16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetU32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.u32FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetU32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetU32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetU64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.u64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetU64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetU64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, Provided.remaining$bytes_Buf, Provided.chunk$bytes_Buf, Provided.advance$bytes_Buf as (a0: Provided.Provided, a1: rt.usize) => undefined, Provided.copyToSlice$bytes_Buf as (a0: Provided.Provided, a1: rt.ByteSlice) => undefined); + } + + tryGetU8$Buf(): rt.Result { + const part = Provided.tryGetU8$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUint$Buf(a: rt.usize): rt.Result { + const part = Provided.tryGetUint$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintLe$Buf(a: rt.usize): rt.Result { + const part = Provided.tryGetUintLe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintNe$Buf(a: rt.usize): rt.Result { + const part = Provided.tryGetUintNe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } +} + +export class of$bytes_Bytes { + v: rt.ByteSlice; + + constructor(v: rt.ByteSlice) { + this.v = v; + } + + advance$Buf(a: rt.usize): void { + return rt.bytesAdvance(this, a); + } + + chunk$Buf(): rt.ByteSlice { + return this.v; + } + + copyToBytes$Buf(a: rt.usize): rt.ByteSlice { + return rt.bytesSplitTo(this, a); + } + + copyToSlice$Buf(a: rt.ByteSlice): void { + return rt.bytesCopyToSlice(this, a); + } + + getF32$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesRead(this, 4, false)); + } + + getF32Le$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesRead(this, 4, true)); + } + + getF32Ne$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesRead(this, 4, true)); + } + + getF64$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesRead(this, 8, false)); + } + + getF64Le$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesRead(this, 8, true)); + } + + getF64Ne$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesRead(this, 8, true)); + } + + getI128$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesRead(this, 16, false)); + } + + getI128Le$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesRead(this, 16, true)); + } + + getI128Ne$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesRead(this, 16, true)); + } + + getI16$Buf(): rt.i16 { + return (rt.bytesReadWord(this, 2, false) << 16) >> 16 as rt.i16; + } + + getI16Le$Buf(): rt.i16 { + return (rt.bytesReadWord(this, 2, true) << 16) >> 16 as rt.i16; + } + + getI16Ne$Buf(): rt.i16 { + return (rt.bytesReadWord(this, 2, true) << 16) >> 16 as rt.i16; + } + + getI32$Buf(): rt.i32 { + return (rt.bytesReadWord(this, 4, false) | 0) as rt.i32; + } + + getI32Le$Buf(): rt.i32 { + return (rt.bytesReadWord(this, 4, true) | 0) as rt.i32; + } + + getI32Ne$Buf(): rt.i32 { + return (rt.bytesReadWord(this, 4, true) | 0) as rt.i32; + } + + getI64$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesRead(this, 8, false)); + } + + getI64Le$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesRead(this, 8, true)); + } + + getI64Ne$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesRead(this, 8, true)); + } + + getI8$Buf(): rt.i8 { + return (rt.bytesReadWord(this, 1, false) << 24) >> 24 as rt.i8; + } + + getInt$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesReadInt(this, 8, a, true, false)); + } + + getIntLe$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesReadInt(this, 8, a, true, true)); + } + + getIntNe$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesReadInt(this, 8, a, true, true)); + } + + getU128$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesRead(this, 16, false)); + } + + getU128Le$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesRead(this, 16, true)); + } + + getU128Ne$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesRead(this, 16, true)); + } + + getU16$Buf(): rt.u16 { + return rt.bytesReadWord(this, 2, false) as rt.u16; + } + + getU16Le$Buf(): rt.u16 { + return rt.bytesReadWord(this, 2, true) as rt.u16; + } + + getU16Ne$Buf(): rt.u16 { + return rt.bytesReadWord(this, 2, true) as rt.u16; + } + + getU32$Buf(): rt.u32 { + return rt.bytesReadWord(this, 4, false) as rt.u32; + } + + getU32Le$Buf(): rt.u32 { + return rt.bytesReadWord(this, 4, true) as rt.u32; + } + + getU32Ne$Buf(): rt.u32 { + return rt.bytesReadWord(this, 4, true) as rt.u32; + } + + getU64$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesRead(this, 8, false)); + } + + getU64Le$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesRead(this, 8, true)); + } + + getU64Ne$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesRead(this, 8, true)); + } + + getU8$Buf(): rt.u8 { + return rt.bytesReadWord(this, 1, false) as rt.u8; + } + + getUint$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesReadInt(this, 8, a, false, false)); + } + + getUintLe$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesReadInt(this, 8, a, false, true)); + } + + getUintNe$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesReadInt(this, 8, a, false, true)); + } + + hasRemaining$Buf(): boolean { + return this.v.length !== 0; + } + + remaining$Buf(): rt.usize { + return this.v.length; + } + + tryCopyToSlice$Buf(a: rt.ByteSlice): rt.Result { + return tryCopyToSlice$bytes_Buf_bytes_Bytes(this, a); + } + + tryGetF32$Buf(): rt.Result { + const part = tryGetF32$bytes_Buf_bytes_Bytes(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Le$Buf(): rt.Result { + const part = tryGetF32Le$bytes_Buf_bytes_Bytes(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Ne$Buf(): rt.Result { + const part = tryGetF32Ne$bytes_Buf_bytes_Bytes(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64$Buf(): rt.Result { + const part = tryGetF64$bytes_Buf_bytes_Bytes(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Le$Buf(): rt.Result { + const part = tryGetF64Le$bytes_Buf_bytes_Bytes(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Ne$Buf(): rt.Result { + const part = tryGetF64Ne$bytes_Buf_bytes_Bytes(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetI128$Buf(): rt.Result { + return rt.bufTryGet(this, 16, false, rt.i128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI128Le$Buf(): rt.Result { + return rt.bufTryGet(this, 16, true, rt.i128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI128Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 16, true, rt.i128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI16$Buf(): rt.Result { + return rt.bufTryGet(this, 2, false, rt.i16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI16Le$Buf(): rt.Result { + return rt.bufTryGet(this, 2, true, rt.i16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI16Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 2, true, rt.i16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI32$Buf(): rt.Result { + return rt.bufTryGet(this, 4, false, rt.i32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI32Le$Buf(): rt.Result { + return rt.bufTryGet(this, 4, true, rt.i32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI32Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 4, true, rt.i32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI64$Buf(): rt.Result { + return rt.bufTryGet(this, 8, false, rt.i64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI64Le$Buf(): rt.Result { + return rt.bufTryGet(this, 8, true, rt.i64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI64Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 8, true, rt.i64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI8$Buf(): rt.Result { + const part = tryGetI8$bytes_Buf_bytes_Bytes(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetInt$Buf(a: rt.usize): rt.Result { + const part = tryGetInt$bytes_Buf_bytes_Bytes(this, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntLe$Buf(a: rt.usize): rt.Result { + const part = tryGetIntLe$bytes_Buf_bytes_Bytes(this, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntNe$Buf(a: rt.usize): rt.Result { + const part = tryGetIntNe$bytes_Buf_bytes_Bytes(this, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetU128$Buf(): rt.Result { + return rt.bufTryGet(this, 16, false, rt.u128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU128Le$Buf(): rt.Result { + return rt.bufTryGet(this, 16, true, rt.u128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU128Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 16, true, rt.u128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU16$Buf(): rt.Result { + return rt.bufTryGet(this, 2, false, rt.u16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU16Le$Buf(): rt.Result { + return rt.bufTryGet(this, 2, true, rt.u16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU16Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 2, true, rt.u16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU32$Buf(): rt.Result { + return rt.bufTryGet(this, 4, false, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU32Le$Buf(): rt.Result { + return rt.bufTryGet(this, 4, true, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU32Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 4, true, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU64$Buf(): rt.Result { + return rt.bufTryGet(this, 8, false, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU64Le$Buf(): rt.Result { + return rt.bufTryGet(this, 8, true, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU64Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 8, true, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU8$Buf(): rt.Result { + const part = tryGetU8$bytes_Buf_bytes_Bytes(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUint$Buf(a: rt.usize): rt.Result { + const part = tryGetUint$bytes_Buf_bytes_Bytes(this, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintLe$Buf(a: rt.usize): rt.Result { + const part = tryGetUintLe$bytes_Buf_bytes_Bytes(this, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintNe$Buf(a: rt.usize): rt.Result { + const part = tryGetUintNe$bytes_Buf_bytes_Bytes(this, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } +} + +export class of$bytes_BytesMut { + v: rt.BytesMut; + + constructor(v: rt.BytesMut) { + this.v = v; + } + + advance$Buf(a: rt.usize): void { + return rt.bytesMutAdvance(this.v, a); + } + + chunk$Buf(): rt.ByteSlice { + return rt.bytesMutView(this.v); + } + + copyToBytes$Buf(a: rt.usize): rt.ByteSlice { + return rt.bytesMutFreeze(rt.bytesMutSplitTo(this.v, a)); + } + + copyToSlice$Buf(a: rt.ByteSlice): void { + return rt.bytesMutCopyToSlice(this.v, a); + } + + getF32$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesMutRead(this.v, 4, false)); + } + + getF32Le$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesMutRead(this.v, 4, true)); + } + + getF32Ne$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesMutRead(this.v, 4, true)); + } + + getF64$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesMutRead(this.v, 8, false)); + } + + getF64Le$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesMutRead(this.v, 8, true)); + } + + getF64Ne$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesMutRead(this.v, 8, true)); + } + + getI128$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesMutRead(this.v, 16, false)); + } + + getI128Le$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesMutRead(this.v, 16, true)); + } + + getI128Ne$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesMutRead(this.v, 16, true)); + } + + getI16$Buf(): rt.i16 { + return (rt.bytesMutReadWord(this.v, 2, false) << 16) >> 16 as rt.i16; + } + + getI16Le$Buf(): rt.i16 { + return (rt.bytesMutReadWord(this.v, 2, true) << 16) >> 16 as rt.i16; + } + + getI16Ne$Buf(): rt.i16 { + return (rt.bytesMutReadWord(this.v, 2, true) << 16) >> 16 as rt.i16; + } + + getI32$Buf(): rt.i32 { + return (rt.bytesMutReadWord(this.v, 4, false) | 0) as rt.i32; + } + + getI32Le$Buf(): rt.i32 { + return (rt.bytesMutReadWord(this.v, 4, true) | 0) as rt.i32; + } + + getI32Ne$Buf(): rt.i32 { + return (rt.bytesMutReadWord(this.v, 4, true) | 0) as rt.i32; + } + + getI64$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesMutRead(this.v, 8, false)); + } + + getI64Le$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesMutRead(this.v, 8, true)); + } + + getI64Ne$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesMutRead(this.v, 8, true)); + } + + getI8$Buf(): rt.i8 { + return (rt.bytesMutReadWord(this.v, 1, false) << 24) >> 24 as rt.i8; + } + + getInt$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesMutReadInt(this.v, 8, a, true, false)); + } + + getIntLe$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesMutReadInt(this.v, 8, a, true, true)); + } + + getIntNe$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesMutReadInt(this.v, 8, a, true, true)); + } + + getU128$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesMutRead(this.v, 16, false)); + } + + getU128Le$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesMutRead(this.v, 16, true)); + } + + getU128Ne$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesMutRead(this.v, 16, true)); + } + + getU16$Buf(): rt.u16 { + return rt.bytesMutReadWord(this.v, 2, false) as rt.u16; + } + + getU16Le$Buf(): rt.u16 { + return rt.bytesMutReadWord(this.v, 2, true) as rt.u16; + } + + getU16Ne$Buf(): rt.u16 { + return rt.bytesMutReadWord(this.v, 2, true) as rt.u16; + } + + getU32$Buf(): rt.u32 { + return rt.bytesMutReadWord(this.v, 4, false) as rt.u32; + } + + getU32Le$Buf(): rt.u32 { + return rt.bytesMutReadWord(this.v, 4, true) as rt.u32; + } + + getU32Ne$Buf(): rt.u32 { + return rt.bytesMutReadWord(this.v, 4, true) as rt.u32; + } + + getU64$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesMutRead(this.v, 8, false)); + } + + getU64Le$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesMutRead(this.v, 8, true)); + } + + getU64Ne$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesMutRead(this.v, 8, true)); + } + + getU8$Buf(): rt.u8 { + return rt.bytesMutReadWord(this.v, 1, false) as rt.u8; + } + + getUint$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesMutReadInt(this.v, 8, a, false, false)); + } + + getUintLe$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesMutReadInt(this.v, 8, a, false, true)); + } + + getUintNe$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesMutReadInt(this.v, 8, a, false, true)); + } + + hasRemaining$Buf(): boolean { + return this.v.length !== 0; + } + + remaining$Buf(): rt.usize { + return this.v.length; + } + + tryCopyToSlice$Buf(a: rt.ByteSlice): rt.Result { + return tryCopyToSlice$bytes_Buf_bytes_BytesMut(this.v, a); + } + + tryGetF32$Buf(): rt.Result { + const part = tryGetF32$bytes_Buf_bytes_BytesMut(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Le$Buf(): rt.Result { + const part = tryGetF32Le$bytes_Buf_bytes_BytesMut(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Ne$Buf(): rt.Result { + const part = tryGetF32Ne$bytes_Buf_bytes_BytesMut(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64$Buf(): rt.Result { + const part = tryGetF64$bytes_Buf_bytes_BytesMut(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Le$Buf(): rt.Result { + const part = tryGetF64Le$bytes_Buf_bytes_BytesMut(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Ne$Buf(): rt.Result { + const part = tryGetF64Ne$bytes_Buf_bytes_BytesMut(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetI128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.i128FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetI128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetI128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetI16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.i16FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetI16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetI16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetI32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.i32FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetI32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetI32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetI64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.i64FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetI64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetI64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetI8$Buf(): rt.Result { + const part = tryGetI8$bytes_Buf_bytes_BytesMut(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetInt$Buf(a: rt.usize): rt.Result { + const part = tryGetInt$bytes_Buf_bytes_BytesMut(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntLe$Buf(a: rt.usize): rt.Result { + const part = tryGetIntLe$bytes_Buf_bytes_BytesMut(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntNe$Buf(a: rt.usize): rt.Result { + const part = tryGetIntNe$bytes_Buf_bytes_BytesMut(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetU128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.u128FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetU128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetU128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetU16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.u16FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetU16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetU16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetU32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.u32FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetU32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetU32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetU64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.u64FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetU64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetU64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + } + + tryGetU8$Buf(): rt.Result { + const part = tryGetU8$bytes_Buf_bytes_BytesMut(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUint$Buf(a: rt.usize): rt.Result { + const part = tryGetUint$bytes_Buf_bytes_BytesMut(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintLe$Buf(a: rt.usize): rt.Result { + const part = tryGetUintLe$bytes_Buf_bytes_BytesMut(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintNe$Buf(a: rt.usize): rt.Result { + const part = tryGetUintNe$bytes_Buf_bytes_BytesMut(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } +} + +export class of$bytes_buf_Take_bytes_Bytes { + v: Take.Take; + + constructor(v: Take.Take) { + this.v = v; + } + + advance$Buf(a: rt.usize): void { + return Take.advance$bytes_Buf_bytes_Bytes(this.v, a); + } + + chunk$Buf(): rt.ByteSlice { + return Take.chunk$bytes_Buf_bytes_Bytes(this.v); + } + + copyToBytes$Buf(a: rt.usize): rt.ByteSlice { + return Take.copyToBytes$bytes_Buf_bytes_Bytes(this.v, a); + } + + copyToSlice$Buf(a: rt.ByteSlice): void { + return Take.copyToSlice$bytes_Buf_bytes_Bytes(this.v, a); + } + + getF32$Buf(): rt.f32 { + return Take.getF32$bytes_Buf_bytes_Bytes(this.v); + } + + getF32Le$Buf(): rt.f32 { + return Take.getF32Le$bytes_Buf_bytes_Bytes(this.v); + } + + getF32Ne$Buf(): rt.f32 { + return Take.getF32Ne$bytes_Buf_bytes_Bytes(this.v); + } + + getF64$Buf(): rt.f64 { + return Take.getF64$bytes_Buf_bytes_Bytes(this.v); + } + + getF64Le$Buf(): rt.f64 { + return Take.getF64Le$bytes_Buf_bytes_Bytes(this.v); + } + + getF64Ne$Buf(): rt.f64 { + return Take.getF64Ne$bytes_Buf_bytes_Bytes(this.v); + } + + getI128$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, false, rt.i128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getI128Le$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, true, rt.i128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getI128Ne$Buf(): rt.i128 { + return rt.bufGet(this.v, 16, true, rt.i128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getI16$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, false, rt.i16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getI16Le$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, true, rt.i16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getI16Ne$Buf(): rt.i16 { + return rt.bufGet(this.v, 2, true, rt.i16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getI32$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, false, rt.i32FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getI32Le$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, true, rt.i32FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getI32Ne$Buf(): rt.i32 { + return rt.bufGet(this.v, 4, true, rt.i32FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getI64$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, false, rt.i64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getI64Le$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, true, rt.i64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getI64Ne$Buf(): rt.i64 { + return rt.bufGet(this.v, 8, true, rt.i64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getI8$Buf(): rt.i8 { + return Take.getI8$bytes_Buf_bytes_Bytes(this.v); + } + + getInt$Buf(a: rt.usize): rt.i64 { + return Take.getInt$bytes_Buf_bytes_Bytes(this.v, a); + } + + getIntLe$Buf(a: rt.usize): rt.i64 { + return Take.getIntLe$bytes_Buf_bytes_Bytes(this.v, a); + } + + getIntNe$Buf(a: rt.usize): rt.i64 { + return Take.getIntNe$bytes_Buf_bytes_Bytes(this.v, a); + } + + getU128$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, false, rt.u128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getU128Le$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, true, rt.u128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getU128Ne$Buf(): rt.u128 { + return rt.bufGet(this.v, 16, true, rt.u128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getU16$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, false, rt.u16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getU16Le$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, true, rt.u16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getU16Ne$Buf(): rt.u16 { + return rt.bufGet(this.v, 2, true, rt.u16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getU32$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, false, rt.u32FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getU32Le$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, true, rt.u32FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getU32Ne$Buf(): rt.u32 { + return rt.bufGet(this.v, 4, true, rt.u32FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getU64$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, false, rt.u64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getU64Le$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, true, rt.u64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getU64Ne$Buf(): rt.u64 { + return rt.bufGet(this.v, 8, true, rt.u64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + getU8$Buf(): rt.u8 { + return Take.getU8$bytes_Buf_bytes_Bytes(this.v); + } + + getUint$Buf(a: rt.usize): rt.u64 { + return Take.getUint$bytes_Buf_bytes_Bytes(this.v, a); + } + + getUintLe$Buf(a: rt.usize): rt.u64 { + return Take.getUintLe$bytes_Buf_bytes_Bytes(this.v, a); + } + + getUintNe$Buf(a: rt.usize): rt.u64 { + return Take.getUintNe$bytes_Buf_bytes_Bytes(this.v, a); + } + + hasRemaining$Buf(): boolean { + return Take.hasRemaining$bytes_Buf_bytes_Bytes(this.v); + } + + remaining$Buf(): rt.usize { + return Take.remaining$bytes_Buf_bytes_Bytes(this.v); + } + + tryCopyToSlice$Buf(a: rt.ByteSlice): rt.Result { + return Take.tryCopyToSlice$bytes_Buf_bytes_Bytes(this.v, a); + } + + tryGetF32$Buf(): rt.Result { + const part = Take.tryGetF32$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Le$Buf(): rt.Result { + const part = Take.tryGetF32Le$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Ne$Buf(): rt.Result { + const part = Take.tryGetF32Ne$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64$Buf(): rt.Result { + const part = Take.tryGetF64$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Le$Buf(): rt.Result { + const part = Take.tryGetF64Le$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Ne$Buf(): rt.Result { + const part = Take.tryGetF64Ne$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetI128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.i128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetI128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetI128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetI16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.i16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetI16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetI16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetI32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.i32FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetI32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetI32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetI64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.i64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetI64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetI64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetI8$Buf(): rt.Result { + const part = Take.tryGetI8$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetInt$Buf(a: rt.usize): rt.Result { + const part = Take.tryGetInt$bytes_Buf_bytes_Bytes(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntLe$Buf(a: rt.usize): rt.Result { + const part = Take.tryGetIntLe$bytes_Buf_bytes_Bytes(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntNe$Buf(a: rt.usize): rt.Result { + const part = Take.tryGetIntNe$bytes_Buf_bytes_Bytes(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetU128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.u128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetU128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetU128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetU16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.u16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetU16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetU16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetU32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.u32FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetU32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetU32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetU64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.u64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetU64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetU64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, Take.remaining$bytes_Buf_bytes_Bytes, Take.chunk$bytes_Buf_bytes_Bytes, Take.advance$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.usize) => undefined, Take.copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take.Take, a1: rt.ByteSlice) => undefined); + } + + tryGetU8$Buf(): rt.Result { + const part = Take.tryGetU8$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUint$Buf(a: rt.usize): rt.Result { + const part = Take.tryGetUint$bytes_Buf_bytes_Bytes(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintLe$Buf(a: rt.usize): rt.Result { + const part = Take.tryGetUintLe$bytes_Buf_bytes_Bytes(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintNe$Buf(a: rt.usize): rt.Result { + const part = Take.tryGetUintNe$bytes_Buf_bytes_Bytes(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } +} + +export class of$ref_slice_u8 { + v: rt.ByteSlice; + + constructor(v: rt.ByteSlice) { + this.v = v; + } + + advance$Buf(a: rt.usize): void { + return rt.byteSliceAdvance(this, a); + } + + chunk$Buf(): rt.ByteSlice { + return this.v; + } + + copyToBytes$Buf(a: rt.usize): rt.ByteSlice { + return rt.byteSliceCopyToBytes(this, a); + } + + copyToSlice$Buf(a: rt.ByteSlice): void { + return rt.bytesCopyToSlice(this, a); + } + + getF32$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesRead(this, 4, false)); + } + + getF32Le$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesRead(this, 4, true)); + } + + getF32Ne$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesRead(this, 4, true)); + } + + getF64$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesRead(this, 8, false)); + } + + getF64Le$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesRead(this, 8, true)); + } + + getF64Ne$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesRead(this, 8, true)); + } + + getI128$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesRead(this, 16, false)); + } + + getI128Le$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesRead(this, 16, true)); + } + + getI128Ne$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesRead(this, 16, true)); + } + + getI16$Buf(): rt.i16 { + return (rt.bytesReadWord(this, 2, false) << 16) >> 16 as rt.i16; + } + + getI16Le$Buf(): rt.i16 { + return (rt.bytesReadWord(this, 2, true) << 16) >> 16 as rt.i16; + } + + getI16Ne$Buf(): rt.i16 { + return (rt.bytesReadWord(this, 2, true) << 16) >> 16 as rt.i16; + } + + getI32$Buf(): rt.i32 { + return (rt.bytesReadWord(this, 4, false) | 0) as rt.i32; + } + + getI32Le$Buf(): rt.i32 { + return (rt.bytesReadWord(this, 4, true) | 0) as rt.i32; + } + + getI32Ne$Buf(): rt.i32 { + return (rt.bytesReadWord(this, 4, true) | 0) as rt.i32; + } + + getI64$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesRead(this, 8, false)); + } + + getI64Le$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesRead(this, 8, true)); + } + + getI64Ne$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesRead(this, 8, true)); + } + + getI8$Buf(): rt.i8 { + return (rt.bytesReadWord(this, 1, false) << 24) >> 24 as rt.i8; + } + + getInt$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesReadInt(this, 8, a, true, false)); + } + + getIntLe$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesReadInt(this, 8, a, true, true)); + } + + getIntNe$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesReadInt(this, 8, a, true, true)); + } + + getU128$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesRead(this, 16, false)); + } + + getU128Le$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesRead(this, 16, true)); + } + + getU128Ne$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesRead(this, 16, true)); + } + + getU16$Buf(): rt.u16 { + return rt.bytesReadWord(this, 2, false) as rt.u16; + } + + getU16Le$Buf(): rt.u16 { + return rt.bytesReadWord(this, 2, true) as rt.u16; + } + + getU16Ne$Buf(): rt.u16 { + return rt.bytesReadWord(this, 2, true) as rt.u16; + } + + getU32$Buf(): rt.u32 { + return rt.bytesReadWord(this, 4, false) as rt.u32; + } + + getU32Le$Buf(): rt.u32 { + return rt.bytesReadWord(this, 4, true) as rt.u32; + } + + getU32Ne$Buf(): rt.u32 { + return rt.bytesReadWord(this, 4, true) as rt.u32; + } + + getU64$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesRead(this, 8, false)); + } + + getU64Le$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesRead(this, 8, true)); + } + + getU64Ne$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesRead(this, 8, true)); + } + + getU8$Buf(): rt.u8 { + return rt.bytesReadWord(this, 1, false) as rt.u8; + } + + getUint$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesReadInt(this, 8, a, false, false)); + } + + getUintLe$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesReadInt(this, 8, a, false, true)); + } + + getUintNe$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesReadInt(this, 8, a, false, true)); + } + + hasRemaining$Buf(): boolean { + return this.v.length !== 0; + } + + remaining$Buf(): rt.usize { + return this.v.length; + } + + tryCopyToSlice$Buf(a: rt.ByteSlice): rt.Result { + return tryCopyToSlice$bytes_Buf_ref_slice_u8(this, a); + } + + tryGetF32$Buf(): rt.Result { + const part = tryGetF32$bytes_Buf_ref_slice_u8(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Le$Buf(): rt.Result { + const part = tryGetF32Le$bytes_Buf_ref_slice_u8(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Ne$Buf(): rt.Result { + const part = tryGetF32Ne$bytes_Buf_ref_slice_u8(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64$Buf(): rt.Result { + const part = tryGetF64$bytes_Buf_ref_slice_u8(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Le$Buf(): rt.Result { + const part = tryGetF64Le$bytes_Buf_ref_slice_u8(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Ne$Buf(): rt.Result { + const part = tryGetF64Ne$bytes_Buf_ref_slice_u8(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetI128$Buf(): rt.Result { + return rt.bufTryGet(this, 16, false, rt.i128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI128Le$Buf(): rt.Result { + return rt.bufTryGet(this, 16, true, rt.i128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI128Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 16, true, rt.i128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI16$Buf(): rt.Result { + return rt.bufTryGet(this, 2, false, rt.i16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI16Le$Buf(): rt.Result { + return rt.bufTryGet(this, 2, true, rt.i16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI16Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 2, true, rt.i16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI32$Buf(): rt.Result { + return rt.bufTryGet(this, 4, false, rt.i32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI32Le$Buf(): rt.Result { + return rt.bufTryGet(this, 4, true, rt.i32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI32Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 4, true, rt.i32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI64$Buf(): rt.Result { + return rt.bufTryGet(this, 8, false, rt.i64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI64Le$Buf(): rt.Result { + return rt.bufTryGet(this, 8, true, rt.i64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI64Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 8, true, rt.i64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI8$Buf(): rt.Result { + const part = tryGetI8$bytes_Buf_ref_slice_u8(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetInt$Buf(a: rt.usize): rt.Result { + const part = tryGetInt$bytes_Buf_ref_slice_u8(this, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntLe$Buf(a: rt.usize): rt.Result { + const part = tryGetIntLe$bytes_Buf_ref_slice_u8(this, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntNe$Buf(a: rt.usize): rt.Result { + const part = tryGetIntNe$bytes_Buf_ref_slice_u8(this, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetU128$Buf(): rt.Result { + return rt.bufTryGet(this, 16, false, rt.u128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU128Le$Buf(): rt.Result { + return rt.bufTryGet(this, 16, true, rt.u128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU128Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 16, true, rt.u128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU16$Buf(): rt.Result { + return rt.bufTryGet(this, 2, false, rt.u16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU16Le$Buf(): rt.Result { + return rt.bufTryGet(this, 2, true, rt.u16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU16Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 2, true, rt.u16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU32$Buf(): rt.Result { + return rt.bufTryGet(this, 4, false, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU32Le$Buf(): rt.Result { + return rt.bufTryGet(this, 4, true, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU32Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 4, true, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU64$Buf(): rt.Result { + return rt.bufTryGet(this, 8, false, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU64Le$Buf(): rt.Result { + return rt.bufTryGet(this, 8, true, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU64Ne$Buf(): rt.Result { + return rt.bufTryGet(this, 8, true, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU8$Buf(): rt.Result { + const part = tryGetU8$bytes_Buf_ref_slice_u8(this); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUint$Buf(a: rt.usize): rt.Result { + const part = tryGetUint$bytes_Buf_ref_slice_u8(this, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintLe$Buf(a: rt.usize): rt.Result { + const part = tryGetUintLe$bytes_Buf_ref_slice_u8(this, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintNe$Buf(a: rt.usize): rt.Result { + const part = tryGetUintNe$bytes_Buf_ref_slice_u8(this, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } +} + +export class ofPlace$bytes_Bytes { + v: rt.Place; + + constructor(v: rt.Place) { + this.v = v; + } + + advance$Buf(a: rt.usize): void { + return rt.bytesAdvance(this.v, a); + } + + chunk$Buf(): rt.ByteSlice { + return this.v.v; + } + + copyToBytes$Buf(a: rt.usize): rt.ByteSlice { + return rt.bytesSplitTo(this.v, a); + } + + copyToSlice$Buf(a: rt.ByteSlice): void { + return rt.bytesCopyToSlice(this.v, a); + } + + getF32$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesRead(this.v, 4, false)); + } + + getF32Le$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesRead(this.v, 4, true)); + } + + getF32Ne$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesRead(this.v, 4, true)); + } + + getF64$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesRead(this.v, 8, false)); + } + + getF64Le$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesRead(this.v, 8, true)); + } + + getF64Ne$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesRead(this.v, 8, true)); + } + + getI128$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesRead(this.v, 16, false)); + } + + getI128Le$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesRead(this.v, 16, true)); + } + + getI128Ne$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesRead(this.v, 16, true)); + } + + getI16$Buf(): rt.i16 { + return (rt.bytesReadWord(this.v, 2, false) << 16) >> 16 as rt.i16; + } + + getI16Le$Buf(): rt.i16 { + return (rt.bytesReadWord(this.v, 2, true) << 16) >> 16 as rt.i16; + } + + getI16Ne$Buf(): rt.i16 { + return (rt.bytesReadWord(this.v, 2, true) << 16) >> 16 as rt.i16; + } + + getI32$Buf(): rt.i32 { + return (rt.bytesReadWord(this.v, 4, false) | 0) as rt.i32; + } + + getI32Le$Buf(): rt.i32 { + return (rt.bytesReadWord(this.v, 4, true) | 0) as rt.i32; + } + + getI32Ne$Buf(): rt.i32 { + return (rt.bytesReadWord(this.v, 4, true) | 0) as rt.i32; + } + + getI64$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesRead(this.v, 8, false)); + } + + getI64Le$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesRead(this.v, 8, true)); + } + + getI64Ne$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesRead(this.v, 8, true)); + } + + getI8$Buf(): rt.i8 { + return (rt.bytesReadWord(this.v, 1, false) << 24) >> 24 as rt.i8; + } + + getInt$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesReadInt(this.v, 8, a, true, false)); + } + + getIntLe$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesReadInt(this.v, 8, a, true, true)); + } + + getIntNe$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesReadInt(this.v, 8, a, true, true)); + } + + getU128$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesRead(this.v, 16, false)); + } + + getU128Le$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesRead(this.v, 16, true)); + } + + getU128Ne$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesRead(this.v, 16, true)); + } + + getU16$Buf(): rt.u16 { + return rt.bytesReadWord(this.v, 2, false) as rt.u16; + } + + getU16Le$Buf(): rt.u16 { + return rt.bytesReadWord(this.v, 2, true) as rt.u16; + } + + getU16Ne$Buf(): rt.u16 { + return rt.bytesReadWord(this.v, 2, true) as rt.u16; + } + + getU32$Buf(): rt.u32 { + return rt.bytesReadWord(this.v, 4, false) as rt.u32; + } + + getU32Le$Buf(): rt.u32 { + return rt.bytesReadWord(this.v, 4, true) as rt.u32; + } + + getU32Ne$Buf(): rt.u32 { + return rt.bytesReadWord(this.v, 4, true) as rt.u32; + } + + getU64$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesRead(this.v, 8, false)); + } + + getU64Le$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesRead(this.v, 8, true)); + } + + getU64Ne$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesRead(this.v, 8, true)); + } + + getU8$Buf(): rt.u8 { + return rt.bytesReadWord(this.v, 1, false) as rt.u8; + } + + getUint$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesReadInt(this.v, 8, a, false, false)); + } + + getUintLe$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesReadInt(this.v, 8, a, false, true)); + } + + getUintNe$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesReadInt(this.v, 8, a, false, true)); + } + + hasRemaining$Buf(): boolean { + return this.v.v.length !== 0; + } + + remaining$Buf(): rt.usize { + return this.v.v.length; + } + + tryCopyToSlice$Buf(a: rt.ByteSlice): rt.Result { + return tryCopyToSlice$bytes_Buf_bytes_Bytes(this.v, a); + } + + tryGetF32$Buf(): rt.Result { + const part = tryGetF32$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Le$Buf(): rt.Result { + const part = tryGetF32Le$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Ne$Buf(): rt.Result { + const part = tryGetF32Ne$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64$Buf(): rt.Result { + const part = tryGetF64$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Le$Buf(): rt.Result { + const part = tryGetF64Le$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Ne$Buf(): rt.Result { + const part = tryGetF64Ne$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetI128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.i128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.i16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.i32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.i64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI8$Buf(): rt.Result { + const part = tryGetI8$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetInt$Buf(a: rt.usize): rt.Result { + const part = tryGetInt$bytes_Buf_bytes_Bytes(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntLe$Buf(a: rt.usize): rt.Result { + const part = tryGetIntLe$bytes_Buf_bytes_Bytes(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntNe$Buf(a: rt.usize): rt.Result { + const part = tryGetIntNe$bytes_Buf_bytes_Bytes(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetU128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.u128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.u16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU8$Buf(): rt.Result { + const part = tryGetU8$bytes_Buf_bytes_Bytes(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUint$Buf(a: rt.usize): rt.Result { + const part = tryGetUint$bytes_Buf_bytes_Bytes(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintLe$Buf(a: rt.usize): rt.Result { + const part = tryGetUintLe$bytes_Buf_bytes_Bytes(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintNe$Buf(a: rt.usize): rt.Result { + const part = tryGetUintNe$bytes_Buf_bytes_Bytes(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } +} + +export class ofPlace$ref_slice_u8 { + v: rt.Place; + + constructor(v: rt.Place) { + this.v = v; + } + + advance$Buf(a: rt.usize): void { + return rt.byteSliceAdvance(this.v, a); + } + + chunk$Buf(): rt.ByteSlice { + return this.v.v; + } + + copyToBytes$Buf(a: rt.usize): rt.ByteSlice { + return rt.byteSliceCopyToBytes(this.v, a); + } + + copyToSlice$Buf(a: rt.ByteSlice): void { + return rt.bytesCopyToSlice(this.v, a); + } + + getF32$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesRead(this.v, 4, false)); + } + + getF32Le$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesRead(this.v, 4, true)); + } + + getF32Ne$Buf(): rt.f32 { + return rt.f32FromBeBytes(rt.bytesRead(this.v, 4, true)); + } + + getF64$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesRead(this.v, 8, false)); + } + + getF64Le$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesRead(this.v, 8, true)); + } + + getF64Ne$Buf(): rt.f64 { + return rt.f64FromBeBytes(rt.bytesRead(this.v, 8, true)); + } + + getI128$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesRead(this.v, 16, false)); + } + + getI128Le$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesRead(this.v, 16, true)); + } + + getI128Ne$Buf(): rt.i128 { + return rt.i128FromBeBytes(rt.bytesRead(this.v, 16, true)); + } + + getI16$Buf(): rt.i16 { + return (rt.bytesReadWord(this.v, 2, false) << 16) >> 16 as rt.i16; + } + + getI16Le$Buf(): rt.i16 { + return (rt.bytesReadWord(this.v, 2, true) << 16) >> 16 as rt.i16; + } + + getI16Ne$Buf(): rt.i16 { + return (rt.bytesReadWord(this.v, 2, true) << 16) >> 16 as rt.i16; + } + + getI32$Buf(): rt.i32 { + return (rt.bytesReadWord(this.v, 4, false) | 0) as rt.i32; + } + + getI32Le$Buf(): rt.i32 { + return (rt.bytesReadWord(this.v, 4, true) | 0) as rt.i32; + } + + getI32Ne$Buf(): rt.i32 { + return (rt.bytesReadWord(this.v, 4, true) | 0) as rt.i32; + } + + getI64$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesRead(this.v, 8, false)); + } + + getI64Le$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesRead(this.v, 8, true)); + } + + getI64Ne$Buf(): rt.i64 { + return rt.i64FromBeBytes(rt.bytesRead(this.v, 8, true)); + } + + getI8$Buf(): rt.i8 { + return (rt.bytesReadWord(this.v, 1, false) << 24) >> 24 as rt.i8; + } + + getInt$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesReadInt(this.v, 8, a, true, false)); + } + + getIntLe$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesReadInt(this.v, 8, a, true, true)); + } + + getIntNe$Buf(a: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesReadInt(this.v, 8, a, true, true)); + } + + getU128$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesRead(this.v, 16, false)); + } + + getU128Le$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesRead(this.v, 16, true)); + } + + getU128Ne$Buf(): rt.u128 { + return rt.u128FromBeBytes(rt.bytesRead(this.v, 16, true)); + } + + getU16$Buf(): rt.u16 { + return rt.bytesReadWord(this.v, 2, false) as rt.u16; + } + + getU16Le$Buf(): rt.u16 { + return rt.bytesReadWord(this.v, 2, true) as rt.u16; + } + + getU16Ne$Buf(): rt.u16 { + return rt.bytesReadWord(this.v, 2, true) as rt.u16; + } + + getU32$Buf(): rt.u32 { + return rt.bytesReadWord(this.v, 4, false) as rt.u32; + } + + getU32Le$Buf(): rt.u32 { + return rt.bytesReadWord(this.v, 4, true) as rt.u32; + } + + getU32Ne$Buf(): rt.u32 { + return rt.bytesReadWord(this.v, 4, true) as rt.u32; + } + + getU64$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesRead(this.v, 8, false)); + } + + getU64Le$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesRead(this.v, 8, true)); + } + + getU64Ne$Buf(): rt.u64 { + return rt.u64FromBeBytes(rt.bytesRead(this.v, 8, true)); + } + + getU8$Buf(): rt.u8 { + return rt.bytesReadWord(this.v, 1, false) as rt.u8; + } + + getUint$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesReadInt(this.v, 8, a, false, false)); + } + + getUintLe$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesReadInt(this.v, 8, a, false, true)); + } + + getUintNe$Buf(a: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesReadInt(this.v, 8, a, false, true)); + } + + hasRemaining$Buf(): boolean { + return this.v.v.length !== 0; + } + + remaining$Buf(): rt.usize { + return this.v.v.length; + } + + tryCopyToSlice$Buf(a: rt.ByteSlice): rt.Result { + return tryCopyToSlice$bytes_Buf_ref_slice_u8(this.v, a); + } + + tryGetF32$Buf(): rt.Result { + const part = tryGetF32$bytes_Buf_ref_slice_u8(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Le$Buf(): rt.Result { + const part = tryGetF32Le$bytes_Buf_ref_slice_u8(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF32Ne$Buf(): rt.Result { + const part = tryGetF32Ne$bytes_Buf_ref_slice_u8(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64$Buf(): rt.Result { + const part = tryGetF64$bytes_Buf_ref_slice_u8(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Le$Buf(): rt.Result { + const part = tryGetF64Le$bytes_Buf_ref_slice_u8(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetF64Ne$Buf(): rt.Result { + const part = tryGetF64Ne$bytes_Buf_ref_slice_u8(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetI128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.i128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.i16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.i32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.i64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetI8$Buf(): rt.Result { + const part = tryGetI8$bytes_Buf_ref_slice_u8(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetInt$Buf(a: rt.usize): rt.Result { + const part = tryGetInt$bytes_Buf_ref_slice_u8(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntLe$Buf(a: rt.usize): rt.Result { + const part = tryGetIntLe$bytes_Buf_ref_slice_u8(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetIntNe$Buf(a: rt.usize): rt.Result { + const part = tryGetIntNe$bytes_Buf_ref_slice_u8(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetU128$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, false, rt.u128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU128Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU128Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU16$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, false, rt.u16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU16Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU16Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU32$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, false, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU32Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU32Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU64$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, false, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU64Le$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU64Ne$Buf(): rt.Result { + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + } + + tryGetU8$Buf(): rt.Result { + const part = tryGetU8$bytes_Buf_ref_slice_u8(this.v); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUint$Buf(a: rt.usize): rt.Result { + const part = tryGetUint$bytes_Buf_ref_slice_u8(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintLe$Buf(a: rt.usize): rt.Result { + const part = tryGetUintLe$bytes_Buf_ref_slice_u8(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } + + tryGetUintNe$Buf(a: rt.usize): rt.Result { + const part = tryGetUintNe$bytes_Buf_ref_slice_u8(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + return result; + } +} + +//# sourceMappingURL=buf_impl.Buf.ts.map diff --git a/ts/fixtures/stock/expected/bytes/buf/buf_impl.ts b/ts/fixtures/stock/expected/bytes/buf/buf_impl.ts index 72c4a6f4d..2f57bb4bd 100644 --- a/ts/fixtures/stock/expected/bytes/buf/buf_impl.ts +++ b/ts/fixtures/stock/expected/bytes/buf/buf_impl.ts @@ -1,12 +1,31 @@ // Generated by rust2-ts. Do not edit. import * as rt from "../../rt.ts"; +import * as Counted from "../../buf.Counted.ts"; +import type * as Leased from "../../buf.Leased.ts"; +import * as Pieces from "../../buf.Pieces.ts"; +import { panicDoesNotFit } from "../../bytes.ts"; +import type * as Buf from "../../bytes/buf/buf_impl.Buf.ts"; +import { new_$bytes_Bytes as take_new_$bytes_Bytes } from "../../bytes/buf/take.ts"; +import type * as Take from "../../bytes/buf/take.Take.ts"; +import type * as TryGetError from "../../bytes.TryGetError.ts"; + +export function signExtend(val: rt.u64, nbytes: rt.usize): rt.i64 { + if (!(nbytes === 0)) { + const shift: rt.usize = rt.usizeMul(rt.usizeSub(8, nbytes), 8); + return rt.i64Shr(rt.i64Cast(rt.u64Shl(val, shift)), shift); + } + return 0; +} /** - * Advance the internal cursor of the Buf + * Copies bytes from `self` into `dst`. * - * The next call to `chunk()` will return a slice starting `cnt` bytes - * further into the underlying buffer. + * The cursor is advanced by the number of bytes copied. `self` must have + * enough remaining bytes to fill `dst`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * @@ -14,35 +33,91 @@ import * as rt from "../../rt.ts"; * use bytes::Buf; * * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 5]; * - * assert_eq!(buf.chunk(), &b"hello world"[..]); + * assert_eq!(Ok(()), buf.try_copy_to_slice(&mut dst)); + * assert_eq!(&b"hello"[..], &dst); + * assert_eq!(6, buf.remaining()); + * ``` * - * buf.advance(6); + * ``` + * use bytes::{Buf, TryGetError}; * - * assert_eq!(buf.chunk(), &b"world"[..]); + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 12]; + * + * assert_eq!(Err(TryGetError{requested: 12, available: 11}), buf.try_copy_to_slice(&mut dst)); + * assert_eq!(11, buf.remaining()); * ``` + */ +export function tryCopyToSlice$bytes_Buf_bytes_Bytes(self: rt.Place, dst: rt.ByteSlice): rt.Result { + if (!(remaining$bytes_Buf_mut_bytes_Bytes(self) < dst.length)) { + while (!(dst.length === 0)) { + const src: rt.ByteSlice = chunk$bytes_Buf_mut_bytes_Bytes(self); + const cnt: rt.usize = rt.min(src.length, dst.length); + rt.byteSliceCopyFromSlice(rt.byteSliceRange(dst, 0, cnt), rt.byteSliceRange(src, 0, cnt)); + dst = rt.byteSliceRange(dst, cnt); + rt.bytesAdvance(self, cnt); + } + return rt.OK; + } + return rt.Err({ requested: dst.length, available: remaining$bytes_Buf_mut_bytes_Bytes(self) }); +} + +/** + * Copies bytes from `self` into `dst`. * - * # Panics + * The cursor is advanced by the number of bytes copied. `self` must have + * enough remaining bytes to fill `dst`. * - * This function **may** panic if `cnt > self.remaining()`. + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * - * # Implementer notes + * # Examples * - * It is recommended for implementations of `advance` to panic if `cnt > - * self.remaining()`. If the implementation does not panic, the call must - * behave as if `cnt == self.remaining()`. + * ``` + * use bytes::Buf; * - * A call with `cnt == 0` should never panic and be a no-op. + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 5]; + * + * assert_eq!(Ok(()), buf.try_copy_to_slice(&mut dst)); + * assert_eq!(&b"hello"[..], &dst); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 12]; + * + * assert_eq!(Err(TryGetError{requested: 12, available: 11}), buf.try_copy_to_slice(&mut dst)); + * assert_eq!(11, buf.remaining()); + * ``` */ -export function advance$bytes_Buf_mut_bytes_Bytes(self: rt.Place>, cnt: rt.usize): void { - rt.bytesAdvance(self.v, cnt); +export function tryCopyToSlice$bytes_Buf_bytes_BytesMut(self: rt.BytesMut, dst: rt.ByteSlice): rt.Result { + if (!(remaining$bytes_Buf_mut_bytes_BytesMut(self) < dst.length)) { + while (!(dst.length === 0)) { + const src: rt.ByteSlice = chunk$bytes_Buf_mut_bytes_BytesMut(self); + const cnt: rt.usize = rt.min(src.length, dst.length); + rt.byteSliceCopyFromSlice(rt.byteSliceRange(dst, 0, cnt), rt.byteSliceRange(src, 0, cnt)); + dst = rt.byteSliceRange(dst, cnt); + rt.bytesMutAdvance(self, cnt); + } + return rt.OK; + } + return rt.Err({ requested: dst.length, available: remaining$bytes_Buf_mut_bytes_BytesMut(self) }); } /** - * Advance the internal cursor of the Buf + * Copies bytes from `self` into `dst`. * - * The next call to `chunk()` will return a slice starting `cnt` bytes - * further into the underlying buffer. + * The cursor is advanced by the number of bytes copied. `self` must have + * enough remaining bytes to fill `dst`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * @@ -50,648 +125,4327 @@ export function advance$bytes_Buf_mut_bytes_Bytes(self: rt.Place, dst: rt.ByteSlice): rt.Result { + if (!(remaining$bytes_Buf_mut_ref_slice_u8(self) < dst.length)) { + while (!(dst.length === 0)) { + const src: rt.ByteSlice = chunk$bytes_Buf_mut_ref_slice_u8(self); + const cnt: rt.usize = rt.min(src.length, dst.length); + rt.byteSliceCopyFromSlice(rt.byteSliceRange(dst, 0, cnt), rt.byteSliceRange(src, 0, cnt)); + dst = rt.byteSliceRange(dst, cnt); + rt.byteSliceAdvance(self, cnt); + } + return rt.OK; + } + return rt.Err({ requested: dst.length, available: remaining$bytes_Buf_mut_ref_slice_u8(self) }); +} + +/** + * Gets an unsigned 8 bit integer from `self`. * - * # Panics + * The current position is advanced by 1. * - * This function **may** panic if `cnt > self.remaining()`. + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * - * # Implementer notes + * # Examples * - * It is recommended for implementations of `advance` to panic if `cnt > - * self.remaining()`. If the implementation does not panic, the call must - * behave as if `cnt == self.remaining()`. + * ``` + * use bytes::Buf; * - * A call with `cnt == 0` should never panic and be a no-op. + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_u8), buf.try_get_u8()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_u8()); + * ``` */ -export function advance$bytes_Buf_mut_ref_slice_u8(self: rt.Place>, cnt: rt.usize): void { - rt.byteSliceAdvance(self.v, cnt); +export function tryGetU8$bytes_Buf_bytes_Bytes(self: rt.Place): rt.u8 | undefined { + if (!(remaining$bytes_Buf_mut_bytes_Bytes(self) < 1)) { + const _9: rt.ByteSlice = chunk$bytes_Buf_mut_bytes_Bytes(self); + rt.idx(_9, 0); + const ret: rt.u8 = _9.data[_9.start]; + rt.bytesAdvance(self, 1); + return ret; + } + Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_Bytes(self) }; + return undefined; } /** - * Consumes `len` bytes inside self and returns new instance of `Bytes` - * with this data. + * Gets an unsigned 8 bit integer from `self`. * - * This function may be optimized by the underlying type to avoid actual - * copies. For example, `Bytes` implementation will do a shallow copy - * (ref-count increment). + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let bytes = (&b"hello world"[..]).copy_to_bytes(5); - * assert_eq!(&bytes[..], &b"hello"[..]); + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_u8), buf.try_get_u8()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if `len > self.remaining()`. + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_u8()); + * ``` */ -export function copyToBytes$bytes_Buf_mut_bytes_Bytes(self: rt.Place>, len: rt.usize): rt.ByteSlice { - return rt.bytesSplitTo(self.v, len); +export function tryGetU8$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.u8 | undefined { + if (!(remaining$bytes_Buf_mut_bytes_BytesMut(self) < 1)) { + const _9: rt.ByteSlice = chunk$bytes_Buf_mut_bytes_BytesMut(self); + rt.idx(_9, 0); + const ret: rt.u8 = _9.data[_9.start]; + rt.bytesMutAdvance(self, 1); + return ret; + } + Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_BytesMut(self) }; + return undefined; } /** - * Consumes `len` bytes inside self and returns new instance of `Bytes` - * with this data. + * Gets an unsigned 8 bit integer from `self`. * - * This function may be optimized by the underlying type to avoid actual - * copies. For example, `Bytes` implementation will do a shallow copy - * (ref-count increment). + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let bytes = (&b"hello world"[..]).copy_to_bytes(5); - * assert_eq!(&bytes[..], &b"hello"[..]); + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_u8), buf.try_get_u8()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if `len > self.remaining()`. + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_u8()); + * ``` */ -export function copyToBytes$bytes_Buf_mut_ref_slice_u8(self: rt.Place>, len: rt.usize): rt.ByteSlice { - return rt.byteSliceCopyToBytes(self.v, len); +export function tryGetU8$bytes_Buf_ref_slice_u8(self: rt.Place): rt.u8 | undefined { + if (!(remaining$bytes_Buf_mut_ref_slice_u8(self) < 1)) { + const _9: rt.ByteSlice = chunk$bytes_Buf_mut_ref_slice_u8(self); + rt.idx(_9, 0); + const ret: rt.u8 = _9.data[_9.start]; + rt.byteSliceAdvance(self, 1); + return ret; + } + Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_ref_slice_u8(self) }; + return undefined; } /** - * Copies bytes from `self` into `dst`. + * Gets a signed 8 bit integer from `self`. * - * The cursor is advanced by the number of bytes copied. `self` must have - * enough remaining bytes to fill `dst`. + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"hello world"[..]; - * let mut dst = [0; 5]; + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_i8), buf.try_get_i8()); + * assert_eq!(6, buf.remaining()); + * ``` * - * buf.copy_to_slice(&mut dst); - * assert_eq!(&b"hello"[..], &dst); + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_i8()); + * ``` + */ +export function tryGetI8$bytes_Buf_bytes_Bytes(self: rt.Place): rt.i8 | undefined { + if (!(remaining$bytes_Buf_mut_bytes_Bytes(self) < 1)) { + const _10: rt.ByteSlice = chunk$bytes_Buf_mut_bytes_Bytes(self); + rt.idx(_10, 0); + const ret: rt.i8 = (_10.data[_10.start] << 24) >> 24; + rt.bytesAdvance(self, 1); + return ret; + } + Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_Bytes(self) }; + return undefined; +} + +/** + * Gets a signed 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_i8), buf.try_get_i8()); * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if `self.remaining() < dst.len()`. + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_i8()); + * ``` */ -export function copyToSlice$bytes_Buf_mut_bytes_Bytes(self: rt.Place>, dst: rt.ByteSlice): void { - rt.bytesCopyToSlice(self.v, dst); +export function tryGetI8$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.i8 | undefined { + if (!(remaining$bytes_Buf_mut_bytes_BytesMut(self) < 1)) { + const _10: rt.ByteSlice = chunk$bytes_Buf_mut_bytes_BytesMut(self); + rt.idx(_10, 0); + const ret: rt.i8 = (_10.data[_10.start] << 24) >> 24; + rt.bytesMutAdvance(self, 1); + return ret; + } + Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_BytesMut(self) }; + return undefined; } /** - * Copies bytes from `self` into `dst`. + * Gets a signed 8 bit integer from `self`. * - * The cursor is advanced by the number of bytes copied. `self` must have - * enough remaining bytes to fill `dst`. + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"hello world"[..]; - * let mut dst = [0; 5]; + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_i8), buf.try_get_i8()); + * assert_eq!(6, buf.remaining()); + * ``` * - * buf.copy_to_slice(&mut dst); - * assert_eq!(&b"hello"[..], &dst); + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_i8()); + * ``` + */ +export function tryGetI8$bytes_Buf_ref_slice_u8(self: rt.Place): rt.i8 | undefined { + if (!(remaining$bytes_Buf_mut_ref_slice_u8(self) < 1)) { + const _10: rt.ByteSlice = chunk$bytes_Buf_mut_ref_slice_u8(self); + rt.idx(_10, 0); + const ret: rt.i8 = (_10.data[_10.start] << 24) >> 24; + rt.byteSliceAdvance(self, 1); + return ret; + } + Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_ref_slice_u8(self) }; + return undefined; +} + +/** + * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint(3)); * assert_eq!(6, buf.remaining()); * ``` * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * * # Panics * - * This function panics if `self.remaining() < dst.len()`. + * This function panics if `nbytes` > 8. */ -export function copyToSlice$bytes_Buf_mut_ref_slice_u8(self: rt.Place>, dst: rt.ByteSlice): void { - rt.bytesCopyToSlice(self.v, dst); +export function tryGetUint$bytes_Buf_bytes_Bytes(self: rt.Place, nbytes: rt.usize): rt.u64 | undefined { + const _3: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_3 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _3; + const buf: Uint8Array = rt.bytes(8); + const _8: rt.Result = tryCopyToSlice$bytes_Buf_bytes_Bytes(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_8.ok) { + return rt.u64FromBeBytes(buf); + } + Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } } /** - * Gets an IEEE754 single-precision (4 bytes) floating point number from - * `self` in little-endian byte order. + * Gets an unsigned n-byte integer from `self` in big-endian byte order. * - * The current position is advanced by 4. + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; - * assert_eq!(1.2f32, buf.get_f32_le()); + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint(4)); + * assert_eq!(3, buf.remaining()); * ``` * * # Panics * - * This function panics if there is not enough remaining data in `self`. + * This function panics if `nbytes` > 8. */ -export function getF32Le$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.f32 { - return rt.f32FromBeBytes(rt.bytesRead(self.v, 4, true)); +export function tryGetUint$bytes_Buf_bytes_BytesMut(self: rt.BytesMut, nbytes: rt.usize): rt.u64 | undefined { + const _3: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_3 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _3; + const buf: Uint8Array = rt.bytes(8); + const _8: rt.Result = tryCopyToSlice$bytes_Buf_bytes_BytesMut(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_8.ok) { + return rt.u64FromBeBytes(buf); + } + Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } } /** - * Gets an IEEE754 single-precision (4 bytes) floating point number from - * `self` in little-endian byte order. + * Gets an unsigned n-byte integer from `self` in big-endian byte order. * - * The current position is advanced by 4. + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; - * assert_eq!(1.2f32, buf.get_f32_le()); + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint(4)); + * assert_eq!(3, buf.remaining()); * ``` * * # Panics * - * This function panics if there is not enough remaining data in `self`. + * This function panics if `nbytes` > 8. */ -export function getF32Le$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.f32 { - return rt.f32FromBeBytes(rt.bytesRead(self.v, 4, true)); +export function tryGetUint$bytes_Buf_ref_slice_u8(self: rt.Place, nbytes: rt.usize): rt.u64 | undefined { + const _3: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_3 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _3; + const buf: Uint8Array = rt.bytes(8); + const _8: rt.Result = tryCopyToSlice$bytes_Buf_ref_slice_u8(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_8.ok) { + return rt.u64FromBeBytes(buf); + } + Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets an unsigned n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint_le(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint_le(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` > 8. + */ +export function tryGetUintLe$bytes_Buf_bytes_Bytes(self: rt.Place, nbytes: rt.usize): rt.u64 | undefined { + const buf: Uint8Array = rt.bytes(8); + const _4: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_4 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _11: rt.Result = tryCopyToSlice$bytes_Buf_bytes_Bytes(self, _4); + if (_11.ok) { + return rt.u64FromBeBytes(buf.slice().reverse()); + } + Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets an unsigned n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint_le(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint_le(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` > 8. + */ +export function tryGetUintLe$bytes_Buf_bytes_BytesMut(self: rt.BytesMut, nbytes: rt.usize): rt.u64 | undefined { + const buf: Uint8Array = rt.bytes(8); + const _4: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_4 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _11: rt.Result = tryCopyToSlice$bytes_Buf_bytes_BytesMut(self, _4); + if (_11.ok) { + return rt.u64FromBeBytes(buf.slice().reverse()); + } + Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets an unsigned n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint_le(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint_le(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` > 8. + */ +export function tryGetUintLe$bytes_Buf_ref_slice_u8(self: rt.Place, nbytes: rt.usize): rt.u64 | undefined { + const buf: Uint8Array = rt.bytes(8); + const _4: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_4 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _11: rt.Result = tryCopyToSlice$bytes_Buf_ref_slice_u8(self, _4); + if (_11.ok) { + return rt.u64FromBeBytes(buf.slice().reverse()); + } + Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets an unsigned n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint_ne(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03", + * false => b"\x03\x02\x01", + * }; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint_ne(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetUintNe$bytes_Buf_bytes_Bytes(self: rt.Place, nbytes: rt.usize): rt.u64 | undefined { + return tryGetUintLe$bytes_Buf_bytes_Bytes(self, nbytes); +} + +/** + * Gets an unsigned n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint_ne(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03", + * false => b"\x03\x02\x01", + * }; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint_ne(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetUintNe$bytes_Buf_bytes_BytesMut(self: rt.BytesMut, nbytes: rt.usize): rt.u64 | undefined { + return tryGetUintLe$bytes_Buf_bytes_BytesMut(self, nbytes); +} + +/** + * Gets an unsigned n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint_ne(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03", + * false => b"\x03\x02\x01", + * }; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint_ne(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetUintNe$bytes_Buf_ref_slice_u8(self: rt.Place, nbytes: rt.usize): rt.u64 | undefined { + return tryGetUintLe$bytes_Buf_ref_slice_u8(self, nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetInt$bytes_Buf_bytes_Bytes(self: rt.Place, nbytes: rt.usize): rt.i64 | undefined { + const _3: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_3 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _3; + const buf: Uint8Array = rt.bytes(8); + const _8: rt.Result = tryCopyToSlice$bytes_Buf_bytes_Bytes(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_8.ok) { + return rt.i64FromBeBytes(buf); + } + Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets a signed n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetInt$bytes_Buf_bytes_BytesMut(self: rt.BytesMut, nbytes: rt.usize): rt.i64 | undefined { + const _3: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_3 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _3; + const buf: Uint8Array = rt.bytes(8); + const _8: rt.Result = tryCopyToSlice$bytes_Buf_bytes_BytesMut(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_8.ok) { + return rt.i64FromBeBytes(buf); + } + Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets a signed n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetInt$bytes_Buf_ref_slice_u8(self: rt.Place, nbytes: rt.usize): rt.i64 | undefined { + const _3: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_3 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _3; + const buf: Uint8Array = rt.bytes(8); + const _8: rt.Result = tryCopyToSlice$bytes_Buf_ref_slice_u8(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_8.ok) { + return rt.i64FromBeBytes(buf); + } + Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets a signed n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int_le(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int_le(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetIntLe$bytes_Buf_bytes_Bytes(self: rt.Place, nbytes: rt.usize): rt.i64 | undefined { + const buf: Uint8Array = rt.bytes(8); + const _4: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_4 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _11: rt.Result = tryCopyToSlice$bytes_Buf_bytes_Bytes(self, _4); + if (_11.ok) { + return rt.i64FromBeBytes(buf.slice().reverse()); + } + Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets a signed n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int_le(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int_le(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetIntLe$bytes_Buf_bytes_BytesMut(self: rt.BytesMut, nbytes: rt.usize): rt.i64 | undefined { + const buf: Uint8Array = rt.bytes(8); + const _4: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_4 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _11: rt.Result = tryCopyToSlice$bytes_Buf_bytes_BytesMut(self, _4); + if (_11.ok) { + return rt.i64FromBeBytes(buf.slice().reverse()); + } + Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets a signed n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int_le(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int_le(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetIntLe$bytes_Buf_ref_slice_u8(self: rt.Place, nbytes: rt.usize): rt.i64 | undefined { + const buf: Uint8Array = rt.bytes(8); + const _4: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_4 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _11: rt.Result = tryCopyToSlice$bytes_Buf_ref_slice_u8(self, _4); + if (_11.ok) { + return rt.i64FromBeBytes(buf.slice().reverse()); + } + Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets a signed n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int_ne(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03", + * false => b"\x03\x02\x01", + * }; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int_ne(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetIntNe$bytes_Buf_bytes_Bytes(self: rt.Place, nbytes: rt.usize): rt.i64 | undefined { + return tryGetIntLe$bytes_Buf_bytes_Bytes(self, nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int_ne(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03", + * false => b"\x03\x02\x01", + * }; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int_ne(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetIntNe$bytes_Buf_bytes_BytesMut(self: rt.BytesMut, nbytes: rt.usize): rt.i64 | undefined { + return tryGetIntLe$bytes_Buf_bytes_BytesMut(self, nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int_ne(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03", + * false => b"\x03\x02\x01", + * }; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int_ne(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetIntNe$bytes_Buf_ref_slice_u8(self: rt.Place, nbytes: rt.usize): rt.i64 | undefined { + return tryGetIntLe$bytes_Buf_ref_slice_u8(self, nbytes); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\x99\x99\x9A hello"[..]; + * assert_eq!(1.2f32, buf.get_f32()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32$bytes_Buf_bytes_Bytes(self: rt.Place): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, false, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\x99\x99\x9A hello"[..]; + * assert_eq!(1.2f32, buf.get_f32()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, false, rt.u32FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\x99\x99\x9A hello"[..]; + * assert_eq!(1.2f32, buf.get_f32()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32$bytes_Buf_ref_slice_u8(self: rt.Place): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, false, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32_le()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32Le$bytes_Buf_bytes_Bytes(self: rt.Place): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, true, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32_le()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32Le$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, true, rt.u32FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32_le()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32Le$bytes_Buf_ref_slice_u8(self: rt.Place): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, true, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\x99\x99\x9A hello", + * false => b"\x9A\x99\x99\x3F hello", + * }; + * assert_eq!(1.2f32, buf.get_f32_ne()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32_ne()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32Ne$bytes_Buf_bytes_Bytes(self: rt.Place): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, true, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\x99\x99\x9A hello", + * false => b"\x9A\x99\x99\x3F hello", + * }; + * assert_eq!(1.2f32, buf.get_f32_ne()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32_ne()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32Ne$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, true, rt.u32FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\x99\x99\x9A hello", + * false => b"\x9A\x99\x99\x3F hello", + * }; + * assert_eq!(1.2f32, buf.get_f32_ne()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32_ne()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32Ne$bytes_Buf_ref_slice_u8(self: rt.Place): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, true, rt.u32FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64$bytes_Buf_bytes_Bytes(self: rt.Place): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, false, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, false, rt.u64FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64$bytes_Buf_ref_slice_u8(self: rt.Place): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, false, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello"[..]; + * assert_eq!(1.2f64, buf.get_f64_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64_le()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64Le$bytes_Buf_bytes_Bytes(self: rt.Place): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, true, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello"[..]; + * assert_eq!(1.2f64, buf.get_f64_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64_le()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64Le$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, true, rt.u64FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello"[..]; + * assert_eq!(1.2f64, buf.get_f64_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64_le()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64Le$bytes_Buf_ref_slice_u8(self: rt.Place): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, true, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello", + * false => b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello", + * }; + * assert_eq!(1.2f64, buf.get_f64_ne()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64_ne()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64Ne$bytes_Buf_bytes_Bytes(self: rt.Place): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, true, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello", + * false => b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello", + * }; + * assert_eq!(1.2f64, buf.get_f64_ne()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64_ne()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64Ne$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, true, rt.u64FromBeBytes, (a0: rt.BytesMut): rt.usize => { + return a0.length; + }, (a02: rt.BytesMut): rt.ByteSlice => { + return rt.bytesMutView(a02); + }, (a03: rt.BytesMut, a1: rt.usize): undefined => { + rt.bytesMutAdvance(a03, a1); + }, (a04: rt.BytesMut, a12: rt.ByteSlice): undefined => { + rt.bytesMutCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello", + * false => b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello", + * }; + * assert_eq!(1.2f64, buf.get_f64_ne()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64_ne()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64Ne$bytes_Buf_ref_slice_u8(self: rt.Place): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, true, rt.u64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Creates an adaptor which will read at most `limit` bytes from `self`. + * + * This function returns a new instance of `Buf` which will read at most + * `limit` bytes. + * + * # Examples + * + * ``` + * use bytes::{Buf, BufMut}; + * + * let mut buf = b"hello world"[..].take(5); + * let mut dst = vec![]; + * + * dst.put(&mut buf); + * assert_eq!(dst, b"hello"); + * + * let mut buf = buf.into_inner(); + * dst.clear(); + * dst.put(&mut buf); + * assert_eq!(dst, b" world"); + * ``` + */ +export function take$bytes_Buf_bytes_Bytes(self: rt.ByteSlice, limit: rt.usize): Take.Take { + return take_new_$bytes_Bytes(self, limit); +} + +/** + * Advance the internal cursor of the Buf + * + * The next call to `chunk()` will return a slice starting `cnt` bytes + * further into the underlying buffer. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.chunk(), &b"hello world"[..]); + * + * buf.advance(6); + * + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` + * + * # Panics + * + * This function **may** panic if `cnt > self.remaining()`. + * + * # Implementer notes + * + * It is recommended for implementations of `advance` to panic if `cnt > + * self.remaining()`. If the implementation does not panic, the call must + * behave as if `cnt == self.remaining()`. + * + * A call with `cnt == 0` should never panic and be a no-op. + */ +export function advance$bytes_Buf_mut_bytes_Bytes(self: rt.Place>, cnt: rt.usize): void { + rt.bytesAdvance(self.v, cnt); +} + +/** + * Advance the internal cursor of the Buf + * + * The next call to `chunk()` will return a slice starting `cnt` bytes + * further into the underlying buffer. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.chunk(), &b"hello world"[..]); + * + * buf.advance(6); + * + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` + * + * # Panics + * + * This function **may** panic if `cnt > self.remaining()`. + * + * # Implementer notes + * + * It is recommended for implementations of `advance` to panic if `cnt > + * self.remaining()`. If the implementation does not panic, the call must + * behave as if `cnt == self.remaining()`. + * + * A call with `cnt == 0` should never panic and be a no-op. + */ +export function advance$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place, cnt: rt.usize): void { + self.v.advance$Buf(cnt); +} + +/** + * Advance the internal cursor of the Buf + * + * The next call to `chunk()` will return a slice starting `cnt` bytes + * further into the underlying buffer. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.chunk(), &b"hello world"[..]); + * + * buf.advance(6); + * + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` + * + * # Panics + * + * This function **may** panic if `cnt > self.remaining()`. + * + * # Implementer notes + * + * It is recommended for implementations of `advance` to panic if `cnt > + * self.remaining()`. If the implementation does not panic, the call must + * behave as if `cnt == self.remaining()`. + * + * A call with `cnt == 0` should never panic and be a no-op. + */ +export function advance$bytes_Buf_mut_ref_slice_u8(self: rt.Place>, cnt: rt.usize): void { + rt.byteSliceAdvance(self.v, cnt); +} + +/** + * Returns a slice starting at the current position and of length between 0 + * and `Buf::remaining()`. Note that this *can* return a shorter slice (this + * allows non-continuous internal representation). + * + * This is a lower level function. Most operations are done with other + * functions. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.chunk(), &b"hello world"[..]); + * + * buf.advance(6); + * + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` + * + * # Implementer notes + * + * This function should never panic. `chunk()` should return an empty + * slice **if and only if** `remaining()` returns 0. In other words, + * `chunk()` returning an empty slice implies that `remaining()` will + * return 0 and `remaining()` returning 0 implies that `chunk()` will + * return an empty slice. + */ +export function chunk$bytes_Buf_mut_bytes_Bytes(self: rt.Place): rt.ByteSlice { + return self.v; +} + +/** + * Returns a slice starting at the current position and of length between 0 + * and `Buf::remaining()`. Note that this *can* return a shorter slice (this + * allows non-continuous internal representation). + * + * This is a lower level function. Most operations are done with other + * functions. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.chunk(), &b"hello world"[..]); + * + * buf.advance(6); + * + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` + * + * # Implementer notes + * + * This function should never panic. `chunk()` should return an empty + * slice **if and only if** `remaining()` returns 0. In other words, + * `chunk()` returning an empty slice implies that `remaining()` will + * return 0 and `remaining()` returning 0 implies that `chunk()` will + * return an empty slice. + */ +export function chunk$bytes_Buf_mut_bytes_BytesMut(self: rt.BytesMut): rt.ByteSlice { + return rt.bytesMutView(self); +} + +/** + * Returns a slice starting at the current position and of length between 0 + * and `Buf::remaining()`. Note that this *can* return a shorter slice (this + * allows non-continuous internal representation). + * + * This is a lower level function. Most operations are done with other + * functions. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.chunk(), &b"hello world"[..]); + * + * buf.advance(6); + * + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` + * + * # Implementer notes + * + * This function should never panic. `chunk()` should return an empty + * slice **if and only if** `remaining()` returns 0. In other words, + * `chunk()` returning an empty slice implies that `remaining()` will + * return 0 and `remaining()` returning 0 implies that `chunk()` will + * return an empty slice. + */ +export function chunk$bytes_Buf_mut_ref_slice_u8(self: rt.Place): rt.ByteSlice { + return self.v; +} + +/** + * Consumes `len` bytes inside self and returns new instance of `Bytes` + * with this data. + * + * This function may be optimized by the underlying type to avoid actual + * copies. For example, `Bytes` implementation will do a shallow copy + * (ref-count increment). + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let bytes = (&b"hello world"[..]).copy_to_bytes(5); + * assert_eq!(&bytes[..], &b"hello"[..]); + * ``` + * + * # Panics + * + * This function panics if `len > self.remaining()`. + */ +export function copyToBytes$bytes_Buf_mut_bytes_Bytes(self: rt.Place>, len: rt.usize): rt.ByteSlice { + return rt.bytesSplitTo(self.v, len); +} + +/** + * Consumes `len` bytes inside self and returns new instance of `Bytes` + * with this data. + * + * This function may be optimized by the underlying type to avoid actual + * copies. For example, `Bytes` implementation will do a shallow copy + * (ref-count increment). + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let bytes = (&b"hello world"[..]).copy_to_bytes(5); + * assert_eq!(&bytes[..], &b"hello"[..]); + * ``` + * + * # Panics + * + * This function panics if `len > self.remaining()`. + */ +export function copyToBytes$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place, len: rt.usize): rt.ByteSlice { + return self.v.copyToBytes$Buf(len); +} + +/** + * Consumes `len` bytes inside self and returns new instance of `Bytes` + * with this data. + * + * This function may be optimized by the underlying type to avoid actual + * copies. For example, `Bytes` implementation will do a shallow copy + * (ref-count increment). + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let bytes = (&b"hello world"[..]).copy_to_bytes(5); + * assert_eq!(&bytes[..], &b"hello"[..]); + * ``` + * + * # Panics + * + * This function panics if `len > self.remaining()`. + */ +export function copyToBytes$bytes_Buf_mut_ref_slice_u8(self: rt.Place>, len: rt.usize): rt.ByteSlice { + return rt.byteSliceCopyToBytes(self.v, len); +} + +/** + * Copies bytes from `self` into `dst`. + * + * The cursor is advanced by the number of bytes copied. `self` must have + * enough remaining bytes to fill `dst`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 5]; + * + * buf.copy_to_slice(&mut dst); + * assert_eq!(&b"hello"[..], &dst); + * assert_eq!(6, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `self.remaining() < dst.len()`. + */ +export function copyToSlice$bytes_Buf_mut_bytes_Bytes(self: rt.Place>, dst: rt.ByteSlice): void { + rt.bytesCopyToSlice(self.v, dst); +} + +/** + * Copies bytes from `self` into `dst`. + * + * The cursor is advanced by the number of bytes copied. `self` must have + * enough remaining bytes to fill `dst`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 5]; + * + * buf.copy_to_slice(&mut dst); + * assert_eq!(&b"hello"[..], &dst); + * assert_eq!(6, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `self.remaining() < dst.len()`. + */ +export function copyToSlice$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place, dst: rt.ByteSlice): void { + self.v.copyToSlice$Buf(dst); +} + +/** + * Copies bytes from `self` into `dst`. + * + * The cursor is advanced by the number of bytes copied. `self` must have + * enough remaining bytes to fill `dst`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 5]; + * + * buf.copy_to_slice(&mut dst); + * assert_eq!(&b"hello"[..], &dst); + * assert_eq!(6, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `self.remaining() < dst.len()`. + */ +export function copyToSlice$bytes_Buf_mut_ref_slice_u8(self: rt.Place>, dst: rt.ByteSlice): void { + rt.bytesCopyToSlice(self.v, dst); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32Le$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.f32 { + return rt.f32FromBeBytes(rt.bytesRead(self.v, 4, true)); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32Le$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.f32 { + return self.v.getF32Le$Buf(); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32Le$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.f32 { + return rt.f32FromBeBytes(rt.bytesRead(self.v, 4, true)); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.f64 { + return rt.f64FromBeBytes(rt.bytesRead(self.v, 8, false)); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.f64 { + return self.v.getF64$Buf(); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.f64 { + return rt.f64FromBeBytes(rt.bytesRead(self.v, 8, false)); +} + +/** + * Gets a signed 128 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 16. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello"[..]; + * assert_eq!(0x01020304050607080910111213141516, buf.get_i128()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getI128$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.i128 { + return rt.i128FromBeBytes(rt.bytesRead(self.v, 16, false)); +} + +/** + * Gets a signed 128 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 16. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello"[..]; + * assert_eq!(0x01020304050607080910111213141516, buf.get_i128()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getI128$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.i128 { + return self.v.getI128$Buf(); +} + +/** + * Gets a signed 128 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 16. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello"[..]; + * assert_eq!(0x01020304050607080910111213141516, buf.get_i128()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getI128$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.i128 { + return rt.i128FromBeBytes(rt.bytesRead(self.v, 16, false)); +} + +/** + * Gets a signed 16 bit integer from `self` in little-endian byte order. + * + * The current position is advanced by 2. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x09\x08 hello"[..]; + * assert_eq!(0x0809, buf.get_i16_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getI16Le$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.i16 { + return (rt.bytesReadWord(self.v, 2, true) << 16) >> 16 as rt.i16; +} + +/** + * Gets a signed 16 bit integer from `self` in little-endian byte order. + * + * The current position is advanced by 2. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x09\x08 hello"[..]; + * assert_eq!(0x0809, buf.get_i16_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getI16Le$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.i16 { + return self.v.getI16Le$Buf(); +} + +/** + * Gets a signed 16 bit integer from `self` in little-endian byte order. + * + * The current position is advanced by 2. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x09\x08 hello"[..]; + * assert_eq!(0x0809, buf.get_i16_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getI16Le$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.i16 { + return (rt.bytesReadWord(self.v, 2, true) << 16) >> 16 as rt.i16; +} + +/** + * Gets a signed 32 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08\x09\xA0\xA1 hello"[..]; + * assert_eq!(0x0809A0A1, buf.get_i32()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getI32$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.i32 { + return (rt.bytesReadWord(self.v, 4, false) | 0) as rt.i32; +} + +/** + * Gets a signed 32 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08\x09\xA0\xA1 hello"[..]; + * assert_eq!(0x0809A0A1, buf.get_i32()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getI32$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.i32 { + return self.v.getI32$Buf(); +} + +/** + * Gets a signed 32 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08\x09\xA0\xA1 hello"[..]; + * assert_eq!(0x0809A0A1, buf.get_i32()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getI32$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.i32 { + return (rt.bytesReadWord(self.v, 4, false) | 0) as rt.i32; +} + +/** + * Gets a signed 64 bit integer from `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; + * assert_eq!(0x0102030405060708, buf.get_i64_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getI64Le$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.i64 { + return rt.i64FromBeBytes(rt.bytesRead(self.v, 8, true)); +} + +/** + * Gets a signed 64 bit integer from `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; + * assert_eq!(0x0102030405060708, buf.get_i64_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getI64Le$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.i64 { + return self.v.getI64Le$Buf(); +} + +/** + * Gets a signed 64 bit integer from `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; + * assert_eq!(0x0102030405060708, buf.get_i64_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getI64Le$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.i64 { + return rt.i64FromBeBytes(rt.bytesRead(self.v, 8, true)); +} + +/** + * Gets a signed 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(8, buf.get_i8()); + * ``` + * + * # Panics + * + * This function panics if there is no more remaining data in `self`. + */ +export function getI8$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.i8 { + return (rt.bytesReadWord(self.v, 1, false) << 24) >> 24 as rt.i8; +} + +/** + * Gets a signed 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(8, buf.get_i8()); + * ``` + * + * # Panics + * + * This function panics if there is no more remaining data in `self`. + */ +export function getI8$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.i8 { + return self.v.getI8$Buf(); +} + +/** + * Gets a signed 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(8, buf.get_i8()); + * ``` + * + * # Panics + * + * This function panics if there is no more remaining data in `self`. + */ +export function getI8$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.i8 { + return (rt.bytesReadWord(self.v, 1, false) << 24) >> 24 as rt.i8; +} + +/** + * Gets a signed n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(0x010203, buf.get_int_le(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getIntLe$bytes_Buf_mut_bytes_Bytes(self: rt.Place>, nbytes: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesReadInt(self.v, 8, nbytes, true, true)); +} + +/** + * Gets a signed n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(0x010203, buf.get_int_le(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getIntLe$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place, nbytes: rt.usize): rt.i64 { + return self.v.getIntLe$Buf(nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(0x010203, buf.get_int_le(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getIntLe$bytes_Buf_mut_ref_slice_u8(self: rt.Place>, nbytes: rt.usize): rt.i64 { + return rt.i64FromBeBytes(rt.bytesReadInt(self.v, 8, nbytes, true, true)); +} + +/** + * Gets an unsigned 128 bit integer from `self` in little-endian byte order. + * + * The current position is advanced by 16. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; + * assert_eq!(0x01020304050607080910111213141516, buf.get_u128_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getU128Le$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.u128 { + return rt.u128FromBeBytes(rt.bytesRead(self.v, 16, true)); +} + +/** + * Gets an unsigned 128 bit integer from `self` in little-endian byte order. + * + * The current position is advanced by 16. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; + * assert_eq!(0x01020304050607080910111213141516, buf.get_u128_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getU128Le$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.u128 { + return self.v.getU128Le$Buf(); +} + +/** + * Gets an unsigned 128 bit integer from `self` in little-endian byte order. + * + * The current position is advanced by 16. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; + * assert_eq!(0x01020304050607080910111213141516, buf.get_u128_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getU128Le$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.u128 { + return rt.u128FromBeBytes(rt.bytesRead(self.v, 16, true)); +} + +/** + * Gets an unsigned 16 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 2. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08\x09 hello"[..]; + * assert_eq!(0x0809, buf.get_u16()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getU16$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.u16 { + return rt.bytesReadWord(self.v, 2, false) as rt.u16; +} + +/** + * Gets an unsigned 16 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 2. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08\x09 hello"[..]; + * assert_eq!(0x0809, buf.get_u16()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getU16$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.u16 { + return self.v.getU16$Buf(); +} + +/** + * Gets an unsigned 16 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 2. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08\x09 hello"[..]; + * assert_eq!(0x0809, buf.get_u16()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getU16$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.u16 { + return rt.bytesReadWord(self.v, 2, false) as rt.u16; +} + +/** + * Gets an unsigned 32 bit integer from `self` in the little-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\xA1\xA0\x09\x08 hello"[..]; + * assert_eq!(0x0809A0A1, buf.get_u32_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getU32Le$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.u32 { + return rt.bytesReadWord(self.v, 4, true) as rt.u32; +} + +/** + * Gets an unsigned 32 bit integer from `self` in the little-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\xA1\xA0\x09\x08 hello"[..]; + * assert_eq!(0x0809A0A1, buf.get_u32_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getU32Le$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.u32 { + return self.v.getU32Le$Buf(); +} + +/** + * Gets an unsigned 32 bit integer from `self` in the little-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\xA1\xA0\x09\x08 hello"[..]; + * assert_eq!(0x0809A0A1, buf.get_u32_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getU32Le$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.u32 { + return rt.bytesReadWord(self.v, 4, true) as rt.u32; +} + +/** + * Gets an unsigned 64 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08 hello"[..]; + * assert_eq!(0x0102030405060708, buf.get_u64()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getU64$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.u64 { + return rt.u64FromBeBytes(rt.bytesRead(self.v, 8, false)); +} + +/** + * Gets an unsigned 64 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08 hello"[..]; + * assert_eq!(0x0102030405060708, buf.get_u64()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getU64$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.u64 { + return self.v.getU64$Buf(); +} + +/** + * Gets an unsigned 64 bit integer from `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08 hello"[..]; + * assert_eq!(0x0102030405060708, buf.get_u64()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getU64$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.u64 { + return rt.u64FromBeBytes(rt.bytesRead(self.v, 8, false)); +} + +/** + * Gets an unsigned 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(8, buf.get_u8()); + * ``` + * + * # Panics + * + * This function panics if there is no more remaining data in `self`. + */ +export function getU8$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.u8 { + return rt.bytesReadWord(self.v, 1, false) as rt.u8; +} + +/** + * Gets an unsigned 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(8, buf.get_u8()); + * ``` + * + * # Panics + * + * This function panics if there is no more remaining data in `self`. + */ +export function getU8$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.u8 { + return self.v.getU8$Buf(); +} + +/** + * Gets an unsigned 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(8, buf.get_u8()); + * ``` + * + * # Panics + * + * This function panics if there is no more remaining data in `self`. + */ +export function getU8$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.u8 { + return rt.bytesReadWord(self.v, 1, false) as rt.u8; +} + +/** + * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(0x010203, buf.get_uint(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUint$bytes_Buf_mut_bytes_Bytes(self: rt.Place>, nbytes: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesReadInt(self.v, 8, nbytes, false, false)); +} + +/** + * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(0x010203, buf.get_uint(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUint$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place, nbytes: rt.usize): rt.u64 { + return self.v.getUint$Buf(nbytes); +} + +/** + * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(0x010203, buf.get_uint(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUint$bytes_Buf_mut_ref_slice_u8(self: rt.Place>, nbytes: rt.usize): rt.u64 { + return rt.u64FromBeBytes(rt.bytesReadInt(self.v, 8, nbytes, false, false)); +} + +/** + * Returns true if there are any more bytes to consume + * + * This is equivalent to `self.remaining() != 0`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"a"[..]; + * + * assert!(buf.has_remaining()); + * + * buf.get_u8(); + * + * assert!(!buf.has_remaining()); + * ``` + */ +export function hasRemaining$bytes_Buf_mut_boxed_Box_dyn_bytes_Buf(self: rt.Place): boolean { + return hasRemaining$bytes_Buf_boxed_Box_dyn_bytes_Buf(self.v); +} + +/** + * Returns true if there are any more bytes to consume + * + * This is equivalent to `self.remaining() != 0`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"a"[..]; + * + * assert!(buf.has_remaining()); + * + * buf.get_u8(); + * + * assert!(!buf.has_remaining()); + * ``` + */ +export function hasRemaining$bytes_Buf_mut_bytes_Bytes(self: rt.Place): boolean { + return self.v.length !== 0; +} + +/** + * Returns true if there are any more bytes to consume + * + * This is equivalent to `self.remaining() != 0`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"a"[..]; + * + * assert!(buf.has_remaining()); + * + * buf.get_u8(); + * + * assert!(!buf.has_remaining()); + * ``` + */ +export function hasRemaining$bytes_Buf_mut_bytes_BytesMut(self: rt.BytesMut): boolean { + return self.length !== 0; +} + +/** + * Returns true if there are any more bytes to consume + * + * This is equivalent to `self.remaining() != 0`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"a"[..]; + * + * assert!(buf.has_remaining()); + * + * buf.get_u8(); + * + * assert!(!buf.has_remaining()); + * ``` + */ +export function hasRemaining$bytes_Buf_mut_dyn_buf_Leased(self: Leased.Leased): boolean { + return self.hasRemaining$Buf(); +} + +/** + * Returns true if there are any more bytes to consume + * + * This is equivalent to `self.remaining() != 0`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"a"[..]; + * + * assert!(buf.has_remaining()); + * + * buf.get_u8(); + * + * assert!(!buf.has_remaining()); + * ``` + */ +export function hasRemaining$bytes_Buf_mut_dyn_bytes_Buf(self: Buf.Buf): boolean { + return self.hasRemaining$Buf(); +} + +/** + * Returns true if there are any more bytes to consume + * + * This is equivalent to `self.remaining() != 0`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"a"[..]; + * + * assert!(buf.has_remaining()); + * + * buf.get_u8(); + * + * assert!(!buf.has_remaining()); + * ``` + */ +export function hasRemaining$bytes_Buf_mut_mut_bytes_Bytes(self: rt.Place>): boolean { + return hasRemaining$bytes_Buf_mut_bytes_Bytes(self.v); +} + +/** + * Returns true if there are any more bytes to consume + * + * This is equivalent to `self.remaining() != 0`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"a"[..]; + * + * assert!(buf.has_remaining()); + * + * buf.get_u8(); + * + * assert!(!buf.has_remaining()); + * ``` + */ +export function hasRemaining$bytes_Buf_mut_mut_dyn_bytes_Buf(self: rt.Place): boolean { + return hasRemaining$bytes_Buf_mut_dyn_bytes_Buf(self.v); +} + +/** + * Returns true if there are any more bytes to consume + * + * This is equivalent to `self.remaining() != 0`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"a"[..]; + * + * assert!(buf.has_remaining()); + * + * buf.get_u8(); + * + * assert!(!buf.has_remaining()); + * ``` + */ +export function hasRemaining$bytes_Buf_mut_mut_ref_slice_u8(self: rt.Place>): boolean { + return hasRemaining$bytes_Buf_mut_ref_slice_u8(self.v); +} + +/** + * Returns true if there are any more bytes to consume + * + * This is equivalent to `self.remaining() != 0`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"a"[..]; + * + * assert!(buf.has_remaining()); + * + * buf.get_u8(); + * + * assert!(!buf.has_remaining()); + * ``` + */ +export function hasRemaining$bytes_Buf_mut_ref_slice_u8(self: rt.Place): boolean { + return self.v.length !== 0; +} + +/** + * Returns the number of bytes between the current position and the end of + * the buffer. + * + * This value is greater than or equal to the length of the slice returned + * by `chunk()`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.remaining(), 11); + * + * buf.get_u8(); + * + * assert_eq!(buf.remaining(), 10); + * ``` + * + * # Implementer notes + * + * Implementations of `remaining` should ensure that the return value does + * not change unless a call is made to `advance` or any other function that + * is documented to change the `Buf`'s current position. + */ +export function remaining$bytes_Buf_mut_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.usize { + return remaining$bytes_Buf_boxed_Box_dyn_bytes_Buf(self.v); +} + +/** + * Returns the number of bytes between the current position and the end of + * the buffer. + * + * This value is greater than or equal to the length of the slice returned + * by `chunk()`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.remaining(), 11); + * + * buf.get_u8(); + * + * assert_eq!(buf.remaining(), 10); + * ``` + * + * # Implementer notes + * + * Implementations of `remaining` should ensure that the return value does + * not change unless a call is made to `advance` or any other function that + * is documented to change the `Buf`'s current position. + */ +export function remaining$bytes_Buf_mut_bytes_Bytes(self: rt.Place): rt.usize { + return self.v.length; +} + +/** + * Returns the number of bytes between the current position and the end of + * the buffer. + * + * This value is greater than or equal to the length of the slice returned + * by `chunk()`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.remaining(), 11); + * + * buf.get_u8(); + * + * assert_eq!(buf.remaining(), 10); + * ``` + * + * # Implementer notes + * + * Implementations of `remaining` should ensure that the return value does + * not change unless a call is made to `advance` or any other function that + * is documented to change the `Buf`'s current position. + */ +export function remaining$bytes_Buf_mut_bytes_BytesMut(self: rt.BytesMut): rt.usize { + return self.length; +} + +/** + * Returns the number of bytes between the current position and the end of + * the buffer. + * + * This value is greater than or equal to the length of the slice returned + * by `chunk()`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.remaining(), 11); + * + * buf.get_u8(); + * + * assert_eq!(buf.remaining(), 10); + * ``` + * + * # Implementer notes + * + * Implementations of `remaining` should ensure that the return value does + * not change unless a call is made to `advance` or any other function that + * is documented to change the `Buf`'s current position. + */ +export function remaining$bytes_Buf_mut_dyn_buf_Leased(self: Leased.Leased): rt.usize { + return self.remaining$Buf(); +} + +/** + * Returns the number of bytes between the current position and the end of + * the buffer. + * + * This value is greater than or equal to the length of the slice returned + * by `chunk()`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.remaining(), 11); + * + * buf.get_u8(); + * + * assert_eq!(buf.remaining(), 10); + * ``` + * + * # Implementer notes + * + * Implementations of `remaining` should ensure that the return value does + * not change unless a call is made to `advance` or any other function that + * is documented to change the `Buf`'s current position. + */ +export function remaining$bytes_Buf_mut_dyn_bytes_Buf(self: Buf.Buf): rt.usize { + return self.remaining$Buf(); +} + +/** + * Returns the number of bytes between the current position and the end of + * the buffer. + * + * This value is greater than or equal to the length of the slice returned + * by `chunk()`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.remaining(), 11); + * + * buf.get_u8(); + * + * assert_eq!(buf.remaining(), 10); + * ``` + * + * # Implementer notes + * + * Implementations of `remaining` should ensure that the return value does + * not change unless a call is made to `advance` or any other function that + * is documented to change the `Buf`'s current position. + */ +export function remaining$bytes_Buf_mut_mut_bytes_Bytes(self: rt.Place>): rt.usize { + return remaining$bytes_Buf_mut_bytes_Bytes(self.v); +} + +/** + * Returns the number of bytes between the current position and the end of + * the buffer. + * + * This value is greater than or equal to the length of the slice returned + * by `chunk()`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.remaining(), 11); + * + * buf.get_u8(); + * + * assert_eq!(buf.remaining(), 10); + * ``` + * + * # Implementer notes + * + * Implementations of `remaining` should ensure that the return value does + * not change unless a call is made to `advance` or any other function that + * is documented to change the `Buf`'s current position. + */ +export function remaining$bytes_Buf_mut_mut_dyn_bytes_Buf(self: rt.Place): rt.usize { + return remaining$bytes_Buf_mut_dyn_bytes_Buf(self.v); +} + +/** + * Returns the number of bytes between the current position and the end of + * the buffer. + * + * This value is greater than or equal to the length of the slice returned + * by `chunk()`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.remaining(), 11); + * + * buf.get_u8(); + * + * assert_eq!(buf.remaining(), 10); + * ``` + * + * # Implementer notes + * + * Implementations of `remaining` should ensure that the return value does + * not change unless a call is made to `advance` or any other function that + * is documented to change the `Buf`'s current position. + */ +export function remaining$bytes_Buf_mut_mut_ref_slice_u8(self: rt.Place>): rt.usize { + return remaining$bytes_Buf_mut_ref_slice_u8(self.v); +} + +/** + * Returns the number of bytes between the current position and the end of + * the buffer. + * + * This value is greater than or equal to the length of the slice returned + * by `chunk()`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.remaining(), 11); + * + * buf.get_u8(); + * + * assert_eq!(buf.remaining(), 10); + * ``` + * + * # Implementer notes + * + * Implementations of `remaining` should ensure that the return value does + * not change unless a call is made to `advance` or any other function that + * is documented to change the `Buf`'s current position. + */ +export function remaining$bytes_Buf_mut_ref_slice_u8(self: rt.Place): rt.usize { + return self.v.length; } /** - * Gets an IEEE754 double-precision (8 bytes) floating point number from - * `self` in big-endian byte order. + * Gets a signed 64 bit integer from `self` in little-endian byte order. * * The current position is advanced by 8. * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; - * assert_eq!(1.2f64, buf.get_f64()); + * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x0102030405060708_i64), buf.try_get_i64_le()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if there is not enough remaining data in `self`. + * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_i64_le()); + * assert_eq!(7, buf.remaining()); + * ``` */ -export function getF64$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.f64 { - return rt.f64FromBeBytes(rt.bytesRead(self.v, 8, false)); +export function tryGetI64Le$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.i64 | undefined { + const _0: rt.Result = rt.bufTryGet(self.v, 8, true, rt.i64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (!_0.ok) { + Counted.tryGetIntOut$bytes_Buf.err = _0.error; + return undefined; + } + return _0.value; } /** - * Gets an IEEE754 double-precision (8 bytes) floating point number from - * `self` in big-endian byte order. + * Gets a signed 64 bit integer from `self` in little-endian byte order. * * The current position is advanced by 8. * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; - * assert_eq!(1.2f64, buf.get_f64()); + * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x0102030405060708_i64), buf.try_get_i64_le()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if there is not enough remaining data in `self`. + * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_i64_le()); + * assert_eq!(7, buf.remaining()); + * ``` */ -export function getF64$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.f64 { - return rt.f64FromBeBytes(rt.bytesRead(self.v, 8, false)); +export function tryGetI64Le$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.i64 | undefined { + const _0: rt.Result = self.v.tryGetI64Le$Buf(); + if (!_0.ok) { + Counted.tryGetIntOut$bytes_Buf.err = _0.error; + return undefined; + } + return _0.value; } /** - * Gets a signed 128 bit integer from `self` in big-endian byte order. + * Gets a signed 64 bit integer from `self` in little-endian byte order. * - * The current position is advanced by 16. + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello"[..]; - * assert_eq!(0x01020304050607080910111213141516, buf.get_i128()); + * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x0102030405060708_i64), buf.try_get_i64_le()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if there is not enough remaining data in `self`. + * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_i64_le()); + * assert_eq!(7, buf.remaining()); + * ``` */ -export function getI128$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.i128 { - return rt.i128FromBeBytes(rt.bytesRead(self.v, 16, false)); +export function tryGetI64Le$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.i64 | undefined { + const _0: rt.Result = rt.bufTryGet(self.v, 8, true, rt.i64FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (!_0.ok) { + Counted.tryGetIntOut$bytes_Buf.err = _0.error; + return undefined; + } + return _0.value; } /** - * Gets a signed 128 bit integer from `self` in big-endian byte order. + * Gets an unsigned 128 bit integer from `self` in big-endian byte order. * * The current position is advanced by 16. * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * * # Examples * * ``` * use bytes::Buf; * * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello"[..]; - * assert_eq!(0x01020304050607080910111213141516, buf.get_i128()); + * assert_eq!(Ok(0x01020304050607080910111213141516_u128), buf.try_get_u128()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if there is not enough remaining data in `self`. + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15"[..]; + * assert_eq!(Err(TryGetError{requested: 16, available: 15}), buf.try_get_u128()); + * assert_eq!(15, buf.remaining()); + * ``` */ -export function getI128$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.i128 { - return rt.i128FromBeBytes(rt.bytesRead(self.v, 16, false)); +export function tryGetU128$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.u128 | undefined { + const _0: rt.Result = rt.bufTryGet(self.v, 16, false, rt.u128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (!_0.ok) { + Pieces.tryGetU128Out$bytes_Buf_mut.err = _0.error; + return undefined; + } + return _0.value; } /** - * Gets a signed 16 bit integer from `self` in little-endian byte order. + * Gets an unsigned 128 bit integer from `self` in big-endian byte order. * - * The current position is advanced by 2. + * The current position is advanced by 16. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x09\x08 hello"[..]; - * assert_eq!(0x0809, buf.get_i16_le()); + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello"[..]; + * assert_eq!(Ok(0x01020304050607080910111213141516_u128), buf.try_get_u128()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if there is not enough remaining data in `self`. + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15"[..]; + * assert_eq!(Err(TryGetError{requested: 16, available: 15}), buf.try_get_u128()); + * assert_eq!(15, buf.remaining()); + * ``` */ -export function getI16Le$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.i16 { - return (rt.bytesReadWord(self.v, 2, true) << 16) >> 16 as rt.i16; +export function tryGetU128$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.u128 | undefined { + const _0: rt.Result = self.v.tryGetU128$Buf(); + if (!_0.ok) { + Pieces.tryGetU128Out$bytes_Buf_mut.err = _0.error; + return undefined; + } + return _0.value; } /** - * Gets a signed 16 bit integer from `self` in little-endian byte order. + * Gets an unsigned 128 bit integer from `self` in big-endian byte order. * - * The current position is advanced by 2. + * The current position is advanced by 16. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x09\x08 hello"[..]; - * assert_eq!(0x0809, buf.get_i16_le()); + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello"[..]; + * assert_eq!(Ok(0x01020304050607080910111213141516_u128), buf.try_get_u128()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if there is not enough remaining data in `self`. + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15"[..]; + * assert_eq!(Err(TryGetError{requested: 16, available: 15}), buf.try_get_u128()); + * assert_eq!(15, buf.remaining()); + * ``` */ -export function getI16Le$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.i16 { - return (rt.bytesReadWord(self.v, 2, true) << 16) >> 16 as rt.i16; +export function tryGetU128$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.u128 | undefined { + const _0: rt.Result = rt.bufTryGet(self.v, 16, false, rt.u128FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (!_0.ok) { + Pieces.tryGetU128Out$bytes_Buf_mut.err = _0.error; + return undefined; + } + return _0.value; } /** - * Gets a signed 32 bit integer from `self` in big-endian byte order. + * Gets an unsigned 16 bit integer from `self` in big-endian byte order. * - * The current position is advanced by 4. + * The current position is advanced by 2. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x08\x09\xA0\xA1 hello"[..]; - * assert_eq!(0x0809A0A1, buf.get_i32()); + * let mut buf = &b"\x08\x09 hello"[..]; + * assert_eq!(Ok(0x0809_u16), buf.try_get_u16()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if there is not enough remaining data in `self`. + * let mut buf = &b"\x08"[..]; + * assert_eq!(Err(TryGetError{requested: 2, available: 1}), buf.try_get_u16()); + * assert_eq!(1, buf.remaining()); + * ``` */ -export function getI32$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.i32 { - return (rt.bytesReadWord(self.v, 4, false) | 0) as rt.i32; +export function tryGetU16$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.u16 | undefined { + const _0: rt.Result = rt.bufTryGet(self.v, 2, false, rt.u16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.bytesAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (!_0.ok) { + Pieces.tryGetU16Out$bytes_Buf_mut.err = _0.error; + return undefined; + } + return _0.value; } /** - * Gets a signed 32 bit integer from `self` in big-endian byte order. + * Gets an unsigned 16 bit integer from `self` in big-endian byte order. * - * The current position is advanced by 4. + * The current position is advanced by 2. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x08\x09\xA0\xA1 hello"[..]; - * assert_eq!(0x0809A0A1, buf.get_i32()); + * let mut buf = &b"\x08\x09 hello"[..]; + * assert_eq!(Ok(0x0809_u16), buf.try_get_u16()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if there is not enough remaining data in `self`. + * let mut buf = &b"\x08"[..]; + * assert_eq!(Err(TryGetError{requested: 2, available: 1}), buf.try_get_u16()); + * assert_eq!(1, buf.remaining()); + * ``` */ -export function getI32$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.i32 { - return (rt.bytesReadWord(self.v, 4, false) | 0) as rt.i32; +export function tryGetU16$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.u16 | undefined { + const _0: rt.Result = self.v.tryGetU16$Buf(); + if (!_0.ok) { + Pieces.tryGetU16Out$bytes_Buf_mut.err = _0.error; + return undefined; + } + return _0.value; } /** - * Gets a signed 64 bit integer from `self` in little-endian byte order. + * Gets an unsigned 16 bit integer from `self` in big-endian byte order. * - * The current position is advanced by 8. + * The current position is advanced by 2. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; - * assert_eq!(0x0102030405060708, buf.get_i64_le()); + * let mut buf = &b"\x08\x09 hello"[..]; + * assert_eq!(Ok(0x0809_u16), buf.try_get_u16()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if there is not enough remaining data in `self`. + * let mut buf = &b"\x08"[..]; + * assert_eq!(Err(TryGetError{requested: 2, available: 1}), buf.try_get_u16()); + * assert_eq!(1, buf.remaining()); + * ``` */ -export function getI64Le$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.i64 { - return rt.i64FromBeBytes(rt.bytesRead(self.v, 8, true)); +export function tryGetU16$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.u16 | undefined { + const _0: rt.Result = rt.bufTryGet(self.v, 2, false, rt.u16FromBeBytes, (p: rt.Place) => ((a0: rt.ByteSlice): rt.usize => { + return a0.length; + })(p.v), (p: rt.Place) => ((a02: rt.ByteSlice): rt.ByteSlice => { + return a02; + })(p.v), (a03: rt.Place, a1: rt.usize): undefined => { + rt.byteSliceAdvance(a03, a1); + }, (a04: rt.Place, a12: rt.ByteSlice): undefined => { + rt.bytesCopyToSlice(a04, a12); + }); + if (!_0.ok) { + Pieces.tryGetU16Out$bytes_Buf_mut.err = _0.error; + return undefined; + } + return _0.value; } /** - * Gets a signed 64 bit integer from `self` in little-endian byte order. + * Gets an unsigned 8 bit integer from `self`. * - * The current position is advanced by 8. + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; - * assert_eq!(0x0102030405060708, buf.get_i64_le()); + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_u8), buf.try_get_u8()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if there is not enough remaining data in `self`. + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_u8()); + * ``` */ -export function getI64Le$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.i64 { - return rt.i64FromBeBytes(rt.bytesRead(self.v, 8, true)); +export function tryGetU8$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.u8 | undefined { + return tryGetU8$bytes_Buf_bytes_Bytes(self.v); } /** - * Gets a signed 8 bit integer from `self`. + * Gets an unsigned 8 bit integer from `self`. * * The current position is advanced by 1. * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * * # Examples * * ``` * use bytes::Buf; * * let mut buf = &b"\x08 hello"[..]; - * assert_eq!(8, buf.get_i8()); + * assert_eq!(Ok(0x08_u8), buf.try_get_u8()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if there is no more remaining data in `self`. + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_u8()); + * ``` */ -export function getI8$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.i8 { - return (rt.bytesReadWord(self.v, 1, false) << 24) >> 24 as rt.i8; +export function tryGetU8$bytes_Buf_mut_dyn_bytes_Buf(self: rt.Place): rt.u8 | undefined { + const _0: rt.Result = self.v.tryGetU8$Buf(); + if (!_0.ok) { + Counted.tryGetU8Out$bytes_Buf.err = _0.error; + return undefined; + } + return _0.value; } /** - * Gets a signed 8 bit integer from `self`. + * Gets an unsigned 8 bit integer from `self`. * * The current position is advanced by 1. * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * * # Examples * * ``` * use bytes::Buf; * * let mut buf = &b"\x08 hello"[..]; - * assert_eq!(8, buf.get_i8()); + * assert_eq!(Ok(0x08_u8), buf.try_get_u8()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Panics + * ``` + * use bytes::{Buf, TryGetError}; * - * This function panics if there is no more remaining data in `self`. + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_u8()); + * ``` */ -export function getI8$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.i8 { - return (rt.bytesReadWord(self.v, 1, false) << 24) >> 24 as rt.i8; +export function tryGetU8$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.u8 | undefined { + return tryGetU8$bytes_Buf_ref_slice_u8(self.v); } /** - * Gets a signed n-byte integer from `self` in little-endian byte order. + * Advance the internal cursor of the Buf * - * The current position is advanced by `nbytes`. + * The next call to `chunk()` will return a slice starting `cnt` bytes + * further into the underlying buffer. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x03\x02\x01 hello"[..]; - * assert_eq!(0x010203, buf.get_int_le(3)); - * ``` + * let mut buf = &b"hello world"[..]; * - * # Panics + * assert_eq!(buf.chunk(), &b"hello world"[..]); * - * This function panics if there is not enough remaining data in `self`, or - * if `nbytes` is greater than 8. - */ -export function getIntLe$bytes_Buf_mut_bytes_Bytes(self: rt.Place>, nbytes: rt.usize): rt.i64 { - return rt.i64FromBeBytes(rt.bytesReadInt(self.v, 8, nbytes, true, true)); -} - -/** - * Gets a signed n-byte integer from `self` in little-endian byte order. + * buf.advance(6); * - * The current position is advanced by `nbytes`. + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` * - * # Examples + * # Panics * - * ``` - * use bytes::Buf; + * This function **may** panic if `cnt > self.remaining()`. * - * let mut buf = &b"\x03\x02\x01 hello"[..]; - * assert_eq!(0x010203, buf.get_int_le(3)); - * ``` + * # Implementer notes * - * # Panics + * It is recommended for implementations of `advance` to panic if `cnt > + * self.remaining()`. If the implementation does not panic, the call must + * behave as if `cnt == self.remaining()`. * - * This function panics if there is not enough remaining data in `self`, or - * if `nbytes` is greater than 8. + * A call with `cnt == 0` should never panic and be a no-op. */ -export function getIntLe$bytes_Buf_mut_ref_slice_u8(self: rt.Place>, nbytes: rt.usize): rt.i64 { - return rt.i64FromBeBytes(rt.bytesReadInt(self.v, 8, nbytes, true, true)); +export function advance$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place, cnt: rt.usize): void { + self.v.advance$Buf(cnt); } /** - * Gets an unsigned 128 bit integer from `self` in little-endian byte order. + * Consumes `len` bytes inside self and returns new instance of `Bytes` + * with this data. * - * The current position is advanced by 16. + * This function may be optimized by the underlying type to avoid actual + * copies. For example, `Bytes` implementation will do a shallow copy + * (ref-count increment). * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; - * assert_eq!(0x01020304050607080910111213141516, buf.get_u128_le()); + * let bytes = (&b"hello world"[..]).copy_to_bytes(5); + * assert_eq!(&bytes[..], &b"hello"[..]); * ``` * * # Panics * - * This function panics if there is not enough remaining data in `self`. + * This function panics if `len > self.remaining()`. */ -export function getU128Le$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.u128 { - return rt.u128FromBeBytes(rt.bytesRead(self.v, 16, true)); +export function copyToBytes$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place, len: rt.usize): rt.ByteSlice { + return self.v.copyToBytes$Buf(len); } /** - * Gets an unsigned 128 bit integer from `self` in little-endian byte order. + * Copies bytes from `self` into `dst`. * - * The current position is advanced by 16. + * The cursor is advanced by the number of bytes copied. `self` must have + * enough remaining bytes to fill `dst`. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; - * assert_eq!(0x01020304050607080910111213141516, buf.get_u128_le()); + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 5]; + * + * buf.copy_to_slice(&mut dst); + * assert_eq!(&b"hello"[..], &dst); + * assert_eq!(6, buf.remaining()); * ``` * * # Panics * - * This function panics if there is not enough remaining data in `self`. + * This function panics if `self.remaining() < dst.len()`. */ -export function getU128Le$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.u128 { - return rt.u128FromBeBytes(rt.bytesRead(self.v, 16, true)); +export function copyToSlice$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place, dst: rt.ByteSlice): void { + self.v.copyToSlice$Buf(dst); } /** - * Gets an unsigned 16 bit integer from `self` in big-endian byte order. + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. * - * The current position is advanced by 2. + * The current position is advanced by 4. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x08\x09 hello"[..]; - * assert_eq!(0x0809, buf.get_u16()); + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); * ``` * * # Panics * * This function panics if there is not enough remaining data in `self`. */ -export function getU16$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.u16 { - return rt.bytesReadWord(self.v, 2, false) as rt.u16; +export function getF32Le$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.f32 { + return self.v.getF32Le$Buf(); } /** - * Gets an unsigned 16 bit integer from `self` in big-endian byte order. + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. * - * The current position is advanced by 2. + * The current position is advanced by 8. * * # Examples * * ``` * use bytes::Buf; - * - * let mut buf = &b"\x08\x09 hello"[..]; - * assert_eq!(0x0809, buf.get_u16()); + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); * ``` * * # Panics * * This function panics if there is not enough remaining data in `self`. */ -export function getU16$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.u16 { - return rt.bytesReadWord(self.v, 2, false) as rt.u16; +export function getF64$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.f64 { + return self.v.getF64$Buf(); } /** - * Gets an unsigned 32 bit integer from `self` in the little-endian byte order. + * Gets a signed 128 bit integer from `self` in big-endian byte order. * - * The current position is advanced by 4. + * The current position is advanced by 16. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\xA1\xA0\x09\x08 hello"[..]; - * assert_eq!(0x0809A0A1, buf.get_u32_le()); + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello"[..]; + * assert_eq!(0x01020304050607080910111213141516, buf.get_i128()); * ``` * * # Panics * * This function panics if there is not enough remaining data in `self`. */ -export function getU32Le$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.u32 { - return rt.bytesReadWord(self.v, 4, true) as rt.u32; +export function getI128$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.i128 { + return self.v.getI128$Buf(); } /** - * Gets an unsigned 32 bit integer from `self` in the little-endian byte order. + * Gets a signed 16 bit integer from `self` in little-endian byte order. * - * The current position is advanced by 4. + * The current position is advanced by 2. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\xA1\xA0\x09\x08 hello"[..]; - * assert_eq!(0x0809A0A1, buf.get_u32_le()); + * let mut buf = &b"\x09\x08 hello"[..]; + * assert_eq!(0x0809, buf.get_i16_le()); * ``` * * # Panics * * This function panics if there is not enough remaining data in `self`. */ -export function getU32Le$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.u32 { - return rt.bytesReadWord(self.v, 4, true) as rt.u32; +export function getI16Le$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.i16 { + return self.v.getI16Le$Buf(); } /** - * Gets an unsigned 64 bit integer from `self` in big-endian byte order. + * Gets a signed 32 bit integer from `self` in big-endian byte order. * - * The current position is advanced by 8. + * The current position is advanced by 4. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08 hello"[..]; - * assert_eq!(0x0102030405060708, buf.get_u64()); + * let mut buf = &b"\x08\x09\xA0\xA1 hello"[..]; + * assert_eq!(0x0809A0A1, buf.get_i32()); * ``` * * # Panics * * This function panics if there is not enough remaining data in `self`. */ -export function getU64$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.u64 { - return rt.u64FromBeBytes(rt.bytesRead(self.v, 8, false)); +export function getI32$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.i32 { + return self.v.getI32$Buf(); } /** - * Gets an unsigned 64 bit integer from `self` in big-endian byte order. + * Gets a signed 64 bit integer from `self` in little-endian byte order. * * The current position is advanced by 8. * @@ -700,20 +4454,20 @@ export function getU64$bytes_Buf_mut_bytes_Bytes(self: rt.Place>): rt.u64 { - return rt.u64FromBeBytes(rt.bytesRead(self.v, 8, false)); +export function getI64Le$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.i64 { + return self.v.getI64Le$Buf(); } /** - * Gets an unsigned 8 bit integer from `self`. + * Gets a signed 8 bit integer from `self`. * * The current position is advanced by 1. * @@ -723,175 +4477,171 @@ export function getU64$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.u8 { - return rt.bytesReadWord(self.v, 1, false) as rt.u8; +export function getI8$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.i8 { + return self.v.getI8$Buf(); } /** - * Gets an unsigned 8 bit integer from `self`. + * Gets a signed n-byte integer from `self` in little-endian byte order. * - * The current position is advanced by 1. + * The current position is advanced by `nbytes`. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x08 hello"[..]; - * assert_eq!(8, buf.get_u8()); + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(0x010203, buf.get_int_le(3)); * ``` * * # Panics * - * This function panics if there is no more remaining data in `self`. + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. */ -export function getU8$bytes_Buf_mut_ref_slice_u8(self: rt.Place>): rt.u8 { - return rt.bytesReadWord(self.v, 1, false) as rt.u8; +export function getIntLe$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place, nbytes: rt.usize): rt.i64 { + return self.v.getIntLe$Buf(nbytes); } /** - * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * Gets an unsigned 128 bit integer from `self` in little-endian byte order. * - * The current position is advanced by `nbytes`. + * The current position is advanced by 16. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x01\x02\x03 hello"[..]; - * assert_eq!(0x010203, buf.get_uint(3)); + * let mut buf = &b"\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; + * assert_eq!(0x01020304050607080910111213141516, buf.get_u128_le()); * ``` * * # Panics * - * This function panics if there is not enough remaining data in `self`, or - * if `nbytes` is greater than 8. + * This function panics if there is not enough remaining data in `self`. */ -export function getUint$bytes_Buf_mut_bytes_Bytes(self: rt.Place>, nbytes: rt.usize): rt.u64 { - return rt.u64FromBeBytes(rt.bytesReadInt(self.v, 8, nbytes, false, false)); +export function getU128Le$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.u128 { + return self.v.getU128Le$Buf(); } /** - * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * Gets an unsigned 16 bit integer from `self` in big-endian byte order. * - * The current position is advanced by `nbytes`. + * The current position is advanced by 2. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"\x01\x02\x03 hello"[..]; - * assert_eq!(0x010203, buf.get_uint(3)); + * let mut buf = &b"\x08\x09 hello"[..]; + * assert_eq!(0x0809, buf.get_u16()); * ``` * * # Panics * - * This function panics if there is not enough remaining data in `self`, or - * if `nbytes` is greater than 8. + * This function panics if there is not enough remaining data in `self`. */ -export function getUint$bytes_Buf_mut_ref_slice_u8(self: rt.Place>, nbytes: rt.usize): rt.u64 { - return rt.u64FromBeBytes(rt.bytesReadInt(self.v, 8, nbytes, false, false)); +export function getU16$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.u16 { + return self.v.getU16$Buf(); } /** - * Returns true if there are any more bytes to consume + * Gets an unsigned 32 bit integer from `self` in the little-endian byte order. * - * This is equivalent to `self.remaining() != 0`. + * The current position is advanced by 4. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"a"[..]; - * - * assert!(buf.has_remaining()); + * let mut buf = &b"\xA1\xA0\x09\x08 hello"[..]; + * assert_eq!(0x0809A0A1, buf.get_u32_le()); + * ``` * - * buf.get_u8(); + * # Panics * - * assert!(!buf.has_remaining()); - * ``` + * This function panics if there is not enough remaining data in `self`. */ -export function hasRemaining$bytes_Buf_mut_bytes_Bytes(self: rt.Place): boolean { - return self.v.length !== 0; +export function getU32Le$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.u32 { + return self.v.getU32Le$Buf(); } /** - * Returns true if there are any more bytes to consume + * Gets an unsigned 64 bit integer from `self` in big-endian byte order. * - * This is equivalent to `self.remaining() != 0`. + * The current position is advanced by 8. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"a"[..]; - * - * assert!(buf.has_remaining()); + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08 hello"[..]; + * assert_eq!(0x0102030405060708, buf.get_u64()); + * ``` * - * buf.get_u8(); + * # Panics * - * assert!(!buf.has_remaining()); - * ``` + * This function panics if there is not enough remaining data in `self`. */ -export function hasRemaining$bytes_Buf_mut_bytes_BytesMut(self: rt.BytesMut): boolean { - return self.length !== 0; +export function getU64$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.u64 { + return self.v.getU64$Buf(); } /** - * Returns true if there are any more bytes to consume + * Gets an unsigned 8 bit integer from `self`. * - * This is equivalent to `self.remaining() != 0`. + * The current position is advanced by 1. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"a"[..]; - * - * assert!(buf.has_remaining()); + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(8, buf.get_u8()); + * ``` * - * buf.get_u8(); + * # Panics * - * assert!(!buf.has_remaining()); - * ``` + * This function panics if there is no more remaining data in `self`. */ -export function hasRemaining$bytes_Buf_mut_mut_bytes_Bytes(self: rt.Place>): boolean { - return hasRemaining$bytes_Buf_mut_bytes_Bytes(self.v); +export function getU8$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.u8 { + return self.v.getU8$Buf(); } /** - * Returns true if there are any more bytes to consume + * Gets an unsigned n-byte integer from `self` in big-endian byte order. * - * This is equivalent to `self.remaining() != 0`. + * The current position is advanced by `nbytes`. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"a"[..]; - * - * assert!(buf.has_remaining()); + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(0x010203, buf.get_uint(3)); + * ``` * - * buf.get_u8(); + * # Panics * - * assert!(!buf.has_remaining()); - * ``` + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. */ -export function hasRemaining$bytes_Buf_mut_mut_ref_slice_u8(self: rt.Place>): boolean { - return hasRemaining$bytes_Buf_mut_ref_slice_u8(self.v); +export function getUint$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place, nbytes: rt.usize): rt.u64 { + return self.v.getUint$Buf(nbytes); } /** @@ -913,8 +4663,8 @@ export function hasRemaining$bytes_Buf_mut_mut_ref_slice_u8(self: rt.Place): boolean { - return self.v.length !== 0; +export function hasRemaining$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: Buf.Buf): boolean { + return self.hasRemaining$Buf(); } /** @@ -944,132 +4694,147 @@ export function hasRemaining$bytes_Buf_mut_ref_slice_u8(self: rt.Place): rt.usize { - return self.v.length; +export function remaining$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: Buf.Buf): rt.usize { + return self.remaining$Buf(); } /** - * Returns the number of bytes between the current position and the end of - * the buffer. + * Gets a signed 64 bit integer from `self` in little-endian byte order. * - * This value is greater than or equal to the length of the slice returned - * by `chunk()`. + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"hello world"[..]; - * - * assert_eq!(buf.remaining(), 11); - * - * buf.get_u8(); - * - * assert_eq!(buf.remaining(), 10); + * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x0102030405060708_i64), buf.try_get_i64_le()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Implementer notes + * ``` + * use bytes::{Buf, TryGetError}; * - * Implementations of `remaining` should ensure that the return value does - * not change unless a call is made to `advance` or any other function that - * is documented to change the `Buf`'s current position. + * let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_i64_le()); + * assert_eq!(7, buf.remaining()); + * ``` */ -export function remaining$bytes_Buf_mut_bytes_BytesMut(self: rt.BytesMut): rt.usize { - return self.length; +export function tryGetI64Le$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.i64 | undefined { + const _0: rt.Result = self.v.tryGetI64Le$Buf(); + if (!_0.ok) { + Counted.tryGetIntOut$bytes_Buf.err = _0.error; + return undefined; + } + return _0.value; } /** - * Returns the number of bytes between the current position and the end of - * the buffer. + * Gets an unsigned 128 bit integer from `self` in big-endian byte order. * - * This value is greater than or equal to the length of the slice returned - * by `chunk()`. + * The current position is advanced by 16. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"hello world"[..]; - * - * assert_eq!(buf.remaining(), 11); - * - * buf.get_u8(); - * - * assert_eq!(buf.remaining(), 10); + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello"[..]; + * assert_eq!(Ok(0x01020304050607080910111213141516_u128), buf.try_get_u128()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Implementer notes + * ``` + * use bytes::{Buf, TryGetError}; * - * Implementations of `remaining` should ensure that the return value does - * not change unless a call is made to `advance` or any other function that - * is documented to change the `Buf`'s current position. + * let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15"[..]; + * assert_eq!(Err(TryGetError{requested: 16, available: 15}), buf.try_get_u128()); + * assert_eq!(15, buf.remaining()); + * ``` */ -export function remaining$bytes_Buf_mut_mut_bytes_Bytes(self: rt.Place>): rt.usize { - return remaining$bytes_Buf_mut_bytes_Bytes(self.v); +export function tryGetU128$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.u128 | undefined { + const _0: rt.Result = self.v.tryGetU128$Buf(); + if (!_0.ok) { + Pieces.tryGetU128Out$bytes_Buf_mut.err = _0.error; + return undefined; + } + return _0.value; } /** - * Returns the number of bytes between the current position and the end of - * the buffer. + * Gets an unsigned 16 bit integer from `self` in big-endian byte order. * - * This value is greater than or equal to the length of the slice returned - * by `chunk()`. + * The current position is advanced by 2. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"hello world"[..]; - * - * assert_eq!(buf.remaining(), 11); - * - * buf.get_u8(); - * - * assert_eq!(buf.remaining(), 10); + * let mut buf = &b"\x08\x09 hello"[..]; + * assert_eq!(Ok(0x0809_u16), buf.try_get_u16()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Implementer notes + * ``` + * use bytes::{Buf, TryGetError}; * - * Implementations of `remaining` should ensure that the return value does - * not change unless a call is made to `advance` or any other function that - * is documented to change the `Buf`'s current position. + * let mut buf = &b"\x08"[..]; + * assert_eq!(Err(TryGetError{requested: 2, available: 1}), buf.try_get_u16()); + * assert_eq!(1, buf.remaining()); + * ``` */ -export function remaining$bytes_Buf_mut_mut_ref_slice_u8(self: rt.Place>): rt.usize { - return remaining$bytes_Buf_mut_ref_slice_u8(self.v); +export function tryGetU16$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.u16 | undefined { + const _0: rt.Result = self.v.tryGetU16$Buf(); + if (!_0.ok) { + Pieces.tryGetU16Out$bytes_Buf_mut.err = _0.error; + return undefined; + } + return _0.value; } /** - * Returns the number of bytes between the current position and the end of - * the buffer. + * Gets an unsigned 8 bit integer from `self`. * - * This value is greater than or equal to the length of the slice returned - * by `chunk()`. + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. * * # Examples * * ``` * use bytes::Buf; * - * let mut buf = &b"hello world"[..]; - * - * assert_eq!(buf.remaining(), 11); - * - * buf.get_u8(); - * - * assert_eq!(buf.remaining(), 10); + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_u8), buf.try_get_u8()); + * assert_eq!(6, buf.remaining()); * ``` * - * # Implementer notes + * ``` + * use bytes::{Buf, TryGetError}; * - * Implementations of `remaining` should ensure that the return value does - * not change unless a call is made to `advance` or any other function that - * is documented to change the `Buf`'s current position. + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_u8()); + * ``` */ -export function remaining$bytes_Buf_mut_ref_slice_u8(self: rt.Place): rt.usize { - return self.v.length; +export function tryGetU8$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.u8 | undefined { + const _0: rt.Result = self.v.tryGetU8$Buf(); + if (!_0.ok) { + Counted.tryGetU8Out$bytes_Buf.err = _0.error; + return undefined; + } + return _0.value; } //# sourceMappingURL=buf_impl.ts.map diff --git a/ts/fixtures/stock/expected/bytes/buf/take.Take.ts b/ts/fixtures/stock/expected/bytes/buf/take.Take.ts new file mode 100644 index 000000000..d5dcd40ad --- /dev/null +++ b/ts/fixtures/stock/expected/bytes/buf/take.Take.ts @@ -0,0 +1,1284 @@ +// Generated by rust2-ts. Do not edit. + +import * as rt from "../../rt.ts"; +import * as Counted from "../../buf.Counted.ts"; +import { panicAdvance, panicDoesNotFit } from "../../bytes.ts"; +import { signExtend } from "../../bytes/buf/buf_impl.ts"; +import type * as TryGetError from "../../bytes.TryGetError.ts"; +import { min$0wa4xqw } from "../../core/cmp.ts"; +import { unwrapOrElse$1wp5sd9 as result_unwrapOrElse$1wp5sd9, unwrapOrElse$0s2lrc9 as result_unwrapOrElse$0s2lrc9 } from "../../core/result.ts"; + +/** + * Returns true if there are any more bytes to consume + * + * This is equivalent to `self.remaining() != 0`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"a"[..]; + * + * assert!(buf.has_remaining()); + * + * buf.get_u8(); + * + * assert!(!buf.has_remaining()); + * ``` + */ +export function hasRemaining$bytes_Buf_bytes_Bytes(self: Take): boolean { + return remaining$bytes_Buf_bytes_Bytes(self) > 0; +} + +/** + * Copies bytes from `self` into `dst`. + * + * The cursor is advanced by the number of bytes copied. `self` must have + * enough remaining bytes to fill `dst`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 5]; + * + * buf.copy_to_slice(&mut dst); + * assert_eq!(&b"hello"[..], &dst); + * assert_eq!(6, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `self.remaining() < dst.len()`. + */ +export function copyToSlice$bytes_Buf_bytes_Bytes(self: Take, dst: rt.ByteSlice): void { + result_unwrapOrElse$0s2lrc9(tryCopyToSlice$bytes_Buf_bytes_Bytes(self, dst), (error: TryGetError.TryGetError): undefined => { + panicAdvance(error); + }); +} + +/** + * Gets an unsigned 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(8, buf.get_u8()); + * ``` + * + * # Panics + * + * This function panics if there is no more remaining data in `self`. + */ +export function getU8$bytes_Buf_bytes_Bytes(self: Take): rt.u8 { + if (!(remaining$bytes_Buf_mut_bytes_Bytes(self) < 1)) { + const _7: rt.ByteSlice = chunk$bytes_Buf_mut_bytes_Bytes(self); + rt.idx(_7, 0); + const ret: rt.u8 = _7.data[_7.start]; + advance$bytes_Buf_bytes_Bytes(self, 1); + return ret; + } + panicAdvance({ requested: 1, available: 0 }); +} + +/** + * Gets a signed 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(8, buf.get_i8()); + * ``` + * + * # Panics + * + * This function panics if there is no more remaining data in `self`. + */ +export function getI8$bytes_Buf_bytes_Bytes(self: Take): rt.i8 { + if (!(remaining$bytes_Buf_mut_bytes_Bytes(self) < 1)) { + const _8: rt.ByteSlice = chunk$bytes_Buf_mut_bytes_Bytes(self); + rt.idx(_8, 0); + const ret: rt.i8 = (_8.data[_8.start] << 24) >> 24; + advance$bytes_Buf_bytes_Bytes(self, 1); + return ret; + } + panicAdvance({ requested: 1, available: 0 }); +} + +/** + * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(0x010203, buf.get_uint(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUint$bytes_Buf_bytes_Bytes(self: Take, nbytes: rt.usize): rt.u64 { + return result_unwrapOrElse$1wp5sd9(((): rt.Result => { + const _2: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_2 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _2; + const buf: Uint8Array = rt.bytes(8); + const _9: rt.Result = tryCopyToSlice$bytes_Buf_bytes_Bytes(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_9.ok) { + return rt.Ok(rt.u64FromBeBytes(buf)); + } + return _9; + } + })(), (error: TryGetError.TryGetError): rt.u64 => { + panicAdvance(error); + }); +} + +/** + * Gets an unsigned n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(0x010203, buf.get_uint_le(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUintLe$bytes_Buf_bytes_Bytes(self: Take, nbytes: rt.usize): rt.u64 { + return result_unwrapOrElse$1wp5sd9(((): rt.Result => { + const buf: Uint8Array = rt.bytes(8); + const _32: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_32 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _12: rt.Result = tryCopyToSlice$bytes_Buf_bytes_Bytes(self, _32); + if (_12.ok) { + return rt.Ok(rt.u64FromBeBytes(buf.slice().reverse())); + } + return _12; + } + })(), (error: TryGetError.TryGetError): rt.u64 => { + panicAdvance(error); + }); +} + +/** + * Gets an unsigned n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(0x010203, buf.get_uint_ne(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getUintNe$bytes_Buf_bytes_Bytes(self: Take, nbytes: rt.usize): rt.u64 { + return getUintLe$bytes_Buf_bytes_Bytes(self, nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(0x010203, buf.get_int(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getInt$bytes_Buf_bytes_Bytes(self: Take, nbytes: rt.usize): rt.i64 { + return signExtend(getUint$bytes_Buf_bytes_Bytes(self, nbytes), nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(0x010203, buf.get_int_le(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getIntLe$bytes_Buf_bytes_Bytes(self: Take, nbytes: rt.usize): rt.i64 { + return signExtend(getUintLe$bytes_Buf_bytes_Bytes(self, nbytes), nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(0x010203, buf.get_int_ne(3)); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`, or + * if `nbytes` is greater than 8. + */ +export function getIntNe$bytes_Buf_bytes_Bytes(self: Take, nbytes: rt.usize): rt.i64 { + return getIntLe$bytes_Buf_bytes_Bytes(self, nbytes); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\x99\x99\x9A hello"[..]; + * assert_eq!(1.2f32, buf.get_f32()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32$bytes_Buf_bytes_Bytes(self: Take): rt.f32 { + return rt.f32FromBits(rt.bufGet(self, 4, false, rt.u32FromBeBytes, remaining$bytes_Buf_bytes_Bytes, chunk$bytes_Buf_bytes_Bytes, advance$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.usize) => undefined, copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32Le$bytes_Buf_bytes_Bytes(self: Take): rt.f32 { + return rt.f32FromBits(rt.bufGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf_bytes_Bytes, chunk$bytes_Buf_bytes_Bytes, advance$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.usize) => undefined, copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 4. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\x99\x99\x9A hello", + * false => b"\x9A\x99\x99\x3F hello", + * }; + * assert_eq!(1.2f32, buf.get_f32_ne()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF32Ne$bytes_Buf_bytes_Bytes(self: Take): rt.f32 { + return rt.f32FromBits(rt.bufGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf_bytes_Bytes, chunk$bytes_Buf_bytes_Bytes, advance$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.usize) => undefined, copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64$bytes_Buf_bytes_Bytes(self: Take): rt.f64 { + return rt.f64FromBits(rt.bufGet(self, 8, false, rt.u64FromBeBytes, remaining$bytes_Buf_bytes_Bytes, chunk$bytes_Buf_bytes_Bytes, advance$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.usize) => undefined, copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello"[..]; + * assert_eq!(1.2f64, buf.get_f64_le()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64Le$bytes_Buf_bytes_Bytes(self: Take): rt.f64 { + return rt.f64FromBits(rt.bufGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf_bytes_Bytes, chunk$bytes_Buf_bytes_Bytes, advance$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.usize) => undefined, copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.ByteSlice) => undefined)); +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 8. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello", + * false => b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello", + * }; + * assert_eq!(1.2f64, buf.get_f64_ne()); + * ``` + * + * # Panics + * + * This function panics if there is not enough remaining data in `self`. + */ +export function getF64Ne$bytes_Buf_bytes_Bytes(self: Take): rt.f64 { + return rt.f64FromBits(rt.bufGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf_bytes_Bytes, chunk$bytes_Buf_bytes_Bytes, advance$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.usize) => undefined, copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.ByteSlice) => undefined)); +} + +/** + * Copies bytes from `self` into `dst`. + * + * The cursor is advanced by the number of bytes copied. `self` must have + * enough remaining bytes to fill `dst`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 5]; + * + * assert_eq!(Ok(()), buf.try_copy_to_slice(&mut dst)); + * assert_eq!(&b"hello"[..], &dst); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"hello world"[..]; + * let mut dst = [0; 12]; + * + * assert_eq!(Err(TryGetError{requested: 12, available: 11}), buf.try_copy_to_slice(&mut dst)); + * assert_eq!(11, buf.remaining()); + * ``` + */ +export function tryCopyToSlice$bytes_Buf_bytes_Bytes(self: Take, dst: rt.ByteSlice): rt.Result { + if (!(remaining$bytes_Buf_mut_bytes_Bytes(self) < dst.length)) { + while (!(dst.length === 0)) { + const src: rt.ByteSlice = chunk$bytes_Buf_mut_bytes_Bytes(self); + const cnt: rt.usize = rt.min(src.length, dst.length); + rt.byteSliceCopyFromSlice(rt.byteSliceRange(dst, 0, cnt), rt.byteSliceRange(src, 0, cnt)); + dst = rt.byteSliceRange(dst, cnt); + advance$bytes_Buf_bytes_Bytes(self, cnt); + } + return rt.OK; + } + return rt.Err({ requested: dst.length, available: remaining$bytes_Buf_mut_bytes_Bytes(self) }); +} + +/** + * Gets an unsigned 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_u8), buf.try_get_u8()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_u8()); + * ``` + */ +export function tryGetU8$bytes_Buf_bytes_Bytes(self: Take): rt.u8 | undefined { + if (!(remaining$bytes_Buf_mut_bytes_Bytes(self) < 1)) { + const _9: rt.ByteSlice = chunk$bytes_Buf_mut_bytes_Bytes(self); + rt.idx(_9, 0); + const ret: rt.u8 = _9.data[_9.start]; + advance$bytes_Buf_bytes_Bytes(self, 1); + return ret; + } + Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_Bytes(self) }; + return undefined; +} + +/** + * Gets a signed 8 bit integer from `self`. + * + * The current position is advanced by 1. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x08 hello"[..]; + * assert_eq!(Ok(0x08_i8), buf.try_get_i8()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b""[..]; + * assert_eq!(Err(TryGetError{requested: 1, available: 0}), buf.try_get_i8()); + * ``` + */ +export function tryGetI8$bytes_Buf_bytes_Bytes(self: Take): rt.i8 | undefined { + if (!(remaining$bytes_Buf_mut_bytes_Bytes(self) < 1)) { + const _10: rt.ByteSlice = chunk$bytes_Buf_mut_bytes_Bytes(self); + rt.idx(_10, 0); + const ret: rt.i8 = (_10.data[_10.start] << 24) >> 24; + advance$bytes_Buf_bytes_Bytes(self, 1); + return ret; + } + Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_Bytes(self) }; + return undefined; +} + +/** + * Gets an unsigned n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` > 8. + */ +export function tryGetUint$bytes_Buf_bytes_Bytes(self: Take, nbytes: rt.usize): rt.u64 | undefined { + const _3: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_3 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _3; + const buf: Uint8Array = rt.bytes(8); + const _8: rt.Result = tryCopyToSlice$bytes_Buf_bytes_Bytes(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_8.ok) { + return rt.u64FromBeBytes(buf); + } + Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets an unsigned n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint_le(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint_le(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` > 8. + */ +export function tryGetUintLe$bytes_Buf_bytes_Bytes(self: Take, nbytes: rt.usize): rt.u64 | undefined { + const buf: Uint8Array = rt.bytes(8); + const _4: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_4 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _11: rt.Result = tryCopyToSlice$bytes_Buf_bytes_Bytes(self, _4); + if (_11.ok) { + return rt.u64FromBeBytes(buf.slice().reverse()); + } + Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets an unsigned n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(Ok(0x010203_u64), buf.try_get_uint_ne(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03", + * false => b"\x03\x02\x01", + * }; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_uint_ne(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetUintNe$bytes_Buf_bytes_Bytes(self: Take, nbytes: rt.usize): rt.u64 | undefined { + return tryGetUintLe$bytes_Buf_bytes_Bytes(self, nbytes); +} + +/** + * Gets a signed n-byte integer from `self` in big-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x01\x02\x03 hello"[..]; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetInt$bytes_Buf_bytes_Bytes(self: Take, nbytes: rt.usize): rt.i64 | undefined { + const _3: rt.usize | undefined = rt.usizeCheckedSub(8, nbytes); + if (_3 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const sliceAt: rt.usize = _3; + const buf: Uint8Array = rt.bytes(8); + const _8: rt.Result = tryCopyToSlice$bytes_Buf_bytes_Bytes(self, rt.byteSliceRange(rt.byteSliceFrom(buf), sliceAt)); + if (_8.ok) { + return rt.i64FromBeBytes(buf); + } + Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets a signed n-byte integer from `self` in little-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x03\x02\x01 hello"[..]; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int_le(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x01\x02\x03"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int_le(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetIntLe$bytes_Buf_bytes_Bytes(self: Take, nbytes: rt.usize): rt.i64 | undefined { + const buf: Uint8Array = rt.bytes(8); + const _4: rt.ByteSlice | undefined = rt.byteSliceGetRange(rt.byteSliceFrom(buf), 0, nbytes); + if (_4 === undefined) { + panicDoesNotFit(8, nbytes); + } else { + const _11: rt.Result = tryCopyToSlice$bytes_Buf_bytes_Bytes(self, _4); + if (_11.ok) { + return rt.i64FromBeBytes(buf.slice().reverse()); + } + Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; + } +} + +/** + * Gets a signed n-byte integer from `self` in native-endian byte order. + * + * The current position is advanced by `nbytes`. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03 hello", + * false => b"\x03\x02\x01 hello", + * }; + * assert_eq!(Ok(0x010203_i64), buf.try_get_int_ne(3)); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x01\x02\x03", + * false => b"\x03\x02\x01", + * }; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_int_ne(4)); + * assert_eq!(3, buf.remaining()); + * ``` + * + * # Panics + * + * This function panics if `nbytes` is greater than 8. + */ +export function tryGetIntNe$bytes_Buf_bytes_Bytes(self: Take, nbytes: rt.usize): rt.i64 | undefined { + return tryGetIntLe$bytes_Buf_bytes_Bytes(self, nbytes); +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\x99\x99\x9A hello"[..]; + * assert_eq!(1.2f32, buf.get_f32()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32$bytes_Buf_bytes_Bytes(self: Take): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, false, rt.u32FromBeBytes, remaining$bytes_Buf_bytes_Bytes, chunk$bytes_Buf_bytes_Bytes, advance$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.usize) => undefined, copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x9A\x99\x99\x3F hello"[..]; + * assert_eq!(1.2f32, buf.get_f32_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32_le()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32Le$bytes_Buf_bytes_Bytes(self: Take): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf_bytes_Bytes, chunk$bytes_Buf_bytes_Bytes, advance$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.usize) => undefined, copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 single-precision (4 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 4. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\x99\x99\x9A hello", + * false => b"\x9A\x99\x99\x3F hello", + * }; + * assert_eq!(1.2f32, buf.get_f32_ne()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\x99\x99"[..]; + * assert_eq!(Err(TryGetError{requested: 4, available: 3}), buf.try_get_f32_ne()); + * assert_eq!(3, buf.remaining()); + * ``` + */ +export function tryGetF32Ne$bytes_Buf_bytes_Bytes(self: Take): rt.f32 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 4, true, rt.u32FromBeBytes, remaining$bytes_Buf_bytes_Bytes, chunk$bytes_Buf_bytes_Bytes, advance$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.usize) => undefined, copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f32FromBits(_3.value); + } + Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in big-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..]; + * assert_eq!(1.2f64, buf.get_f64()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64$bytes_Buf_bytes_Bytes(self: Take): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, false, rt.u64FromBeBytes, remaining$bytes_Buf_bytes_Bytes, chunk$bytes_Buf_bytes_Bytes, advance$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.usize) => undefined, copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in little-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello"[..]; + * assert_eq!(1.2f64, buf.get_f64_le()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64_le()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64Le$bytes_Buf_bytes_Bytes(self: Take): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf_bytes_Bytes, chunk$bytes_Buf_bytes_Bytes, advance$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.usize) => undefined, copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Gets an IEEE754 double-precision (8 bytes) floating point number from + * `self` in native-endian byte order. + * + * The current position is advanced by 8. + * + * Returns `Err(TryGetError)` when there are not enough + * remaining bytes to read the value. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf: &[u8] = match cfg!(target_endian = "big") { + * true => b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello", + * false => b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello", + * }; + * assert_eq!(1.2f64, buf.get_f64_ne()); + * assert_eq!(6, buf.remaining()); + * ``` + * + * ``` + * use bytes::{Buf, TryGetError}; + * + * let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33"[..]; + * assert_eq!(Err(TryGetError{requested: 8, available: 7}), buf.try_get_f64_ne()); + * assert_eq!(7, buf.remaining()); + * ``` + */ +export function tryGetF64Ne$bytes_Buf_bytes_Bytes(self: Take): rt.f64 | undefined { + const _3: rt.Result = rt.bufTryGet(self, 8, true, rt.u64FromBeBytes, remaining$bytes_Buf_bytes_Bytes, chunk$bytes_Buf_bytes_Bytes, advance$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.usize) => undefined, copyToSlice$bytes_Buf_bytes_Bytes as (a0: Take, a1: rt.ByteSlice) => undefined); + if (_3.ok) { + return rt.f64FromBits(_3.value); + } + Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + return undefined; +} + +/** + * Returns a slice starting at the current position and of length between 0 + * and `Buf::remaining()`. Note that this *can* return a shorter slice (this + * allows non-continuous internal representation). + * + * This is a lower level function. Most operations are done with other + * functions. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.chunk(), &b"hello world"[..]); + * + * buf.advance(6); + * + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` + * + * # Implementer notes + * + * This function should never panic. `chunk()` should return an empty + * slice **if and only if** `remaining()` returns 0. In other words, + * `chunk()` returning an empty slice implies that `remaining()` will + * return 0 and `remaining()` returning 0 implies that `chunk()` will + * return an empty slice. + */ +export function chunk$bytes_Buf_mut_bytes_Bytes(self: Take): rt.ByteSlice { + return chunk$bytes_Buf_bytes_Bytes(self); +} + +/** + * Returns true if there are any more bytes to consume + * + * This is equivalent to `self.remaining() != 0`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"a"[..]; + * + * assert!(buf.has_remaining()); + * + * buf.get_u8(); + * + * assert!(!buf.has_remaining()); + * ``` + */ +export function hasRemaining$bytes_Buf_mut_bytes_Bytes(self: Take): boolean { + return hasRemaining$bytes_Buf_bytes_Bytes(self); +} + +/** + * Returns the number of bytes between the current position and the end of + * the buffer. + * + * This value is greater than or equal to the length of the slice returned + * by `chunk()`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.remaining(), 11); + * + * buf.get_u8(); + * + * assert_eq!(buf.remaining(), 10); + * ``` + * + * # Implementer notes + * + * Implementations of `remaining` should ensure that the return value does + * not change unless a call is made to `advance` or any other function that + * is documented to change the `Buf`'s current position. + */ +export function remaining$bytes_Buf_mut_bytes_Bytes(self: Take): rt.usize { + return remaining$bytes_Buf_bytes_Bytes(self); +} + +/** + * A `Buf` adapter which limits the bytes read from an underlying buffer. + * + * This struct is generally created by calling `take()` on `Buf`. See + * documentation of [`take()`](Buf::take) for more details. + */ +export class Take { + inner: T; + limit: rt.usize; + + constructor(inner: T, limit: rt.usize) { + this.inner = inner; + this.limit = limit; + } +} + +/** + * Returns the number of bytes between the current position and the end of + * the buffer. + * + * This value is greater than or equal to the length of the slice returned + * by `chunk()`. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.remaining(), 11); + * + * buf.get_u8(); + * + * assert_eq!(buf.remaining(), 10); + * ``` + * + * # Implementer notes + * + * Implementations of `remaining` should ensure that the return value does + * not change unless a call is made to `advance` or any other function that + * is documented to change the `Buf`'s current position. + */ +export function remaining$bytes_Buf_bytes_Bytes(self: Take): rt.usize { + return min$0wa4xqw(self.inner.length, self.limit); +} + +/** + * Returns a slice starting at the current position and of length between 0 + * and `Buf::remaining()`. Note that this *can* return a shorter slice (this + * allows non-continuous internal representation). + * + * This is a lower level function. Most operations are done with other + * functions. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.chunk(), &b"hello world"[..]); + * + * buf.advance(6); + * + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` + * + * # Implementer notes + * + * This function should never panic. `chunk()` should return an empty + * slice **if and only if** `remaining()` returns 0. In other words, + * `chunk()` returning an empty slice implies that `remaining()` will + * return 0 and `remaining()` returning 0 implies that `chunk()` will + * return an empty slice. + */ +export function chunk$bytes_Buf_bytes_Bytes(self: Take): rt.ByteSlice { + const bytes: rt.ByteSlice = self.inner; + return rt.byteSliceRange(bytes, 0, min$0wa4xqw(bytes.length, self.limit)); +} + +/** + * Advance the internal cursor of the Buf + * + * The next call to `chunk()` will return a slice starting `cnt` bytes + * further into the underlying buffer. + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let mut buf = &b"hello world"[..]; + * + * assert_eq!(buf.chunk(), &b"hello world"[..]); + * + * buf.advance(6); + * + * assert_eq!(buf.chunk(), &b"world"[..]); + * ``` + * + * # Panics + * + * This function **may** panic if `cnt > self.remaining()`. + * + * # Implementer notes + * + * It is recommended for implementations of `advance` to panic if `cnt > + * self.remaining()`. If the implementation does not panic, the call must + * behave as if `cnt == self.remaining()`. + * + * A call with `cnt == 0` should never panic and be a no-op. + */ +export function advance$bytes_Buf_bytes_Bytes(self: Take, cnt: rt.usize): void { + if (!(cnt <= self.limit)) { + rt.panic("assertion failed: cnt <= self.limit"); + } else { + rt.bytesAdvance(rt.place(() => self.inner, (value) => self.inner = value), cnt); + self.limit = rt.usizeSub(self.limit, cnt); + } +} + +/** + * Consumes `len` bytes inside self and returns new instance of `Bytes` + * with this data. + * + * This function may be optimized by the underlying type to avoid actual + * copies. For example, `Bytes` implementation will do a shallow copy + * (ref-count increment). + * + * # Examples + * + * ``` + * use bytes::Buf; + * + * let bytes = (&b"hello world"[..]).copy_to_bytes(5); + * assert_eq!(&bytes[..], &b"hello"[..]); + * ``` + * + * # Panics + * + * This function panics if `len > self.remaining()`. + */ +export function copyToBytes$bytes_Buf_bytes_Bytes(self: Take, len: rt.usize): rt.ByteSlice { + if (!(len <= remaining$bytes_Buf_mut_bytes_Bytes(self))) { + rt.panicFmt(["`len` greater than remaining"]); + } else { + const r: rt.ByteSlice = rt.bytesSplitTo(rt.place(() => self.inner, (value) => self.inner = value), len); + self.limit = rt.usizeSub(self.limit, len); + return r; + } +} + +//# sourceMappingURL=take.Take.ts.map diff --git a/ts/fixtures/stock/expected/bytes/buf/take.ts b/ts/fixtures/stock/expected/bytes/buf/take.ts new file mode 100644 index 000000000..e27213498 --- /dev/null +++ b/ts/fixtures/stock/expected/bytes/buf/take.ts @@ -0,0 +1,10 @@ +// Generated by rust2-ts. Do not edit. + +import * as rt from "../../rt.ts"; +import * as Take from "../../bytes/buf/take.Take.ts"; + +export function new_$bytes_Bytes(inner: rt.ByteSlice, limit: rt.usize): Take.Take { + return new Take.Take(inner, limit); +} + +//# sourceMappingURL=take.ts.map diff --git a/ts/fixtures/stock/expected/core/cmp.ts b/ts/fixtures/stock/expected/core/cmp.ts new file mode 100644 index 000000000..65d98d4e3 --- /dev/null +++ b/ts/fixtures/stock/expected/core/cmp.ts @@ -0,0 +1,9 @@ +// Generated by rust2-ts. Do not edit. + +import * as rt from "../rt.ts"; + +export function min$0wa4xqw(v1: rt.usize, v2: rt.usize): rt.usize { + return rt.min(v1, v2); +} + +//# sourceMappingURL=cmp.ts.map diff --git a/ts/fixtures/stock/expected/core/result.ts b/ts/fixtures/stock/expected/core/result.ts index ae6e223f3..c509e1c27 100644 --- a/ts/fixtures/stock/expected/core/result.ts +++ b/ts/fixtures/stock/expected/core/result.ts @@ -3,6 +3,34 @@ import * as rt from "../rt.ts"; import type * as TryGetError from "../bytes.TryGetError.ts"; +export function map$0c3nzkx(self: rt.Result, op: (a0: rt.i64) => rt.u128): rt.Result { + if (self.ok) { + return rt.Ok(op(self.value)); + } + return self as rt.Result; +} + +export function map$0hs8st9(self: rt.Result, _: (a0: rt.u16) => rt.u128): rt.Result { + if (self.ok) { + return rt.Ok(self.value as rt.u128); + } + return self as rt.Result; +} + +export function map$01kzrm1(self: rt.Result, _: (a0: rt.u8) => rt.u128): rt.Result { + if (self.ok) { + return rt.Ok(self.value as rt.u128); + } + return self as rt.Result; +} + +export function unwrapOrElse$1wp5sd9(self: rt.Result, op: (a0: TryGetError.TryGetError) => rt.u64): rt.u64 { + if (self.ok) { + return self.value; + } + return op(self.error); +} + export function unwrapOrElse$0s2lrc9(self: rt.Result, op: (a0: TryGetError.TryGetError) => undefined): void { if (!self.ok) { op(self.error); diff --git a/ts/fixtures/stock/expected/harness.ts b/ts/fixtures/stock/expected/harness.ts index 383486577..38821e600 100644 --- a/ts/fixtures/stock/expected/harness.ts +++ b/ts/fixtures/stock/expected/harness.ts @@ -1,7 +1,7 @@ // Generated by rust2-ts. Do not edit. import * as rt from "./rt.ts"; -import { bytesMut, reserves, reads, writes, edits } from "./buf.ts"; +import { bytesMut, reserves, reads, dyns, writes, edits } from "./buf.ts"; import * as Owner from "./harness.Owner.ts"; import { map as maps_map, table, capacity, linked } from "./maps.ts"; @@ -24,10 +24,12 @@ export function cases(): [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefine edits(a08.data, a08.start, a08.length, a18); }] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["buf::reserves", (a09: rt.ByteSlice, a19: rt.ByteVec): undefined => { reserves(a09.data, a09.start, a09.length, a19); - }] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["maps::map", maps_map as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["maps::table", (a011: rt.ByteSlice, a111: rt.ByteVec): undefined => { - table(a011.data, a011.start, a011.length, a111); - }] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["maps::capacity", (a012: rt.ByteSlice, a112: rt.ByteVec): undefined => { - capacity(a012.data, a012.start, a012.length, a112); + }] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["buf::dyns", (a010: rt.ByteSlice, a110: rt.ByteVec): undefined => { + dyns(a010.data, a010.start, a010.length, a110); + }] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["maps::map", maps_map as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["maps::table", (a012: rt.ByteSlice, a112: rt.ByteVec): undefined => { + table(a012.data, a012.start, a012.length, a112); + }] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["maps::capacity", (a013: rt.ByteSlice, a113: rt.ByteVec): undefined => { + capacity(a013.data, a013.start, a013.length, a113); }] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["maps::linked", linked as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined]]; } diff --git a/ts/fixtures/stock/src/buf.rs b/ts/fixtures/stock/src/buf.rs index 1ebe83415..78bcf7927 100644 --- a/ts/fixtures/stock/src/buf.rs +++ b/ts/fixtures/stock/src/buf.rs @@ -1,6 +1,9 @@ //! `bytes`' `BytesMut`, `Buf`, and `BufMut`: each case runs ops its input picks, so the //! differential test reaches their panics and what `split_to` and `freeze` share. +use std::cell::Cell; +use std::rc::Rc; + use bytes::{Buf, BufMut, Bytes, BytesMut}; /// A `BytesMut` split, frozen, grown, and written, ending with every piece's bytes: a @@ -98,9 +101,18 @@ impl Checked for B { } } -/// A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes. -fn read(buf: &mut B, n: usize) -> u128 { - match n % 15 { +/// A scalar read off the front of a buffer by `n`'s pick, as a `u128`'s bytes, or a +/// `try_get_*`'s error as what it asked for and what remained. +fn read(buf: &mut B, n: usize) -> u128 { + let tried = |got: Result| match got { + Ok(v) => v, + Err(e) => (e.requested as u128) << 64 | e.available as u128, + }; + match n % 19 { + 15 => tried(buf.try_get_u16().map(u128::from)), + 16 => tried(buf.try_get_i64_le().map(|v| v as u128)), + 17 => tried(buf.try_get_u128()), + 18 => tried(buf.try_get_u8().map(u128::from)), 0 => buf.get_u8().into(), 1 => buf.get_i8() as u128, 2 => buf.get_u16().into(), @@ -216,23 +228,24 @@ impl Buf for Provided { } } -/// The same reads off a `Bytes`, a `BytesMut`, a `&[u8]`, buffers in pieces, and each -/// through the impl forwarding through a `&mut`: each scalar, and what remains. +/// The same reads off a `Bytes`, a `BytesMut`, a `&[u8]`, buffers in pieces, a `Take`, and +/// each through the impl forwarding through a `&mut`: each scalar, and what remains. pub fn reads(data: &[u8], out: &mut Vec) { let [kind, cut, ops @ ..] = data else { return; }; let (ops, input) = ops.split_at(ops.len() / 2); let cut = *cut as usize % (input.len() + 1); - let rest = match kind % 8 { - 0 => read_all(&mut Bytes::copy_from_slice(input), ops, read, out), - 1 => read_all(&mut BytesMut::from(input), ops, read, out), - 2 => read_all(&mut Pieces::new(input, cut), ops, read_pieces, out), - 3 => read_all(&mut &input[..], ops, read, out), - 4 => read_all(&mut Provided(Pieces::new(input, cut)), ops, read_pieces, out), - 5 => read_all(&mut &mut Bytes::copy_from_slice(input), ops, read, out), - 6 => read_all(&mut &mut &input[..], ops, read, out), - _ => read_all(&mut &mut Pieces::new(input, cut), ops, read_pieces, out), + let rest = match kind % 9 { + 0 => read_all(&mut Bytes::copy_from_slice(input), ops, out), + 1 => read_all(&mut BytesMut::from(input), ops, out), + 2 => read_all(&mut Pieces::new(input, cut), ops, out), + 3 => read_all(&mut &input[..], ops, out), + 4 => read_all(&mut Provided(Pieces::new(input, cut)), ops, out), + 5 => read_all(&mut &mut Bytes::copy_from_slice(input), ops, out), + 6 => read_all(&mut &mut &input[..], ops, out), + 7 => read_all(&mut Bytes::copy_from_slice(input).take(cut), ops, out), + _ => read_all(&mut &mut Pieces::new(input, cut), ops, out), }; out.extend_from_slice(&rest); // Put whole, chunk by chunk. @@ -245,21 +258,8 @@ pub fn reads(data: &[u8], out: &mut Vec) { out.push(slice.has_remaining() as u8); } -/// The reads of `Buf`'s provided methods that translate for a buffer of the crate's own: -/// those whose MIR reads no bytes as another type. -fn read_pieces(buf: &mut B, n: usize) -> u128 { - match n % 2 { - 0 => buf.get_u8().into(), - _ => { - let mut dst = [0; 3]; - buf.copy_to_slice(&mut dst[..n % 4]); - u32::from_be_bytes([0, dst[0], dst[1], dst[2]]).into() - } - } -} - /// `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. -fn read_all(buf: &mut B, ops: &[u8], read: fn(&mut B, usize) -> u128, out: &mut Vec) -> Vec { +fn read_all(buf: &mut B, ops: &[u8], out: &mut Vec) -> Vec { for &op in ops { if op == 0xff { buf.advance(1); @@ -272,6 +272,89 @@ fn read_all(buf: &mut B, ops: &[u8], read: fn(&mut B, usize) -> u128, ou buf.copy_to_bytes(n).to_vec() } +/// A buffer of the crate's own over `Buf`, as moq's transports lend a stream's chunks. +trait Leased: Buf { + fn pieces(&self) -> usize; +} + +impl Leased for Pieces { + fn pieces(&self) -> usize { + self.parts.len() + } +} + +/// Pieces that count their drops. +struct Counted(Pieces, Rc>); + +impl Buf for Counted { + fn remaining(&self) -> usize { + self.0.remaining() + } + + fn chunk(&self) -> &[u8] { + self.0.chunk() + } + + fn advance(&mut self, cnt: usize) { + self.0.advance(cnt); + } +} + +impl Drop for Counted { + fn drop(&mut self) { + self.1.set(self.1.get() + 1); + } +} + +/// The reads of `reads` through a `dyn Buf` of each buffer: called on the object, through +/// the impls forwarding through a `&mut` to one and a `Box` of one, and through the crate's +/// own trait over `Buf`. A box drops what it owns once. +pub fn dyns(data: &[u8], out: &mut Vec) { + let [kind, cut, ops @ ..] = data else { + return; + }; + let (ops, input) = ops.split_at(ops.len() / 2); + let cut = *cut as usize % (input.len() + 1); + let mut bytes = Bytes::copy_from_slice(input); + let mut owned = BytesMut::from(input); + let mut slice = input; + let mut pieces = Pieces::new(input, cut); + let mut provided = Provided(Pieces::new(input, cut)); + let mut take = Bytes::copy_from_slice(input).take(cut); + let buf: &mut dyn Buf = match kind % 6 { + 0 => &mut bytes, + 1 => &mut owned, + 2 => &mut slice, + 3 => &mut pieces, + 4 => &mut provided, + _ => &mut take, + }; + let rest = match kind / 6 % 3 { + 0 => read_all(buf, ops, out), + _ => read_all(&mut &mut *buf, ops, out), + }; + out.extend_from_slice(&rest); + out.push(bytes.len() as u8); + out.push(slice.len() as u8); + + let drops = Rc::new(Cell::new(0)); + let mut boxed: Box = match kind % 3 { + 0 => Box::new(Counted(Pieces::new(input, cut), drops.clone())), + 1 => Box::new(Bytes::copy_from_slice(input)), + _ => Box::new(&input[..]), + }; + let rest = read_all(&mut boxed, ops, out); + out.extend_from_slice(&rest); + drop(boxed); + out.push(drops.get()); + + let mut leased: Box = Box::new(Pieces::new(input, cut)); + out.push(leased.pieces() as u8); + let rest = read_all(&mut *leased, ops, out); + out.extend_from_slice(&rest); + out.push(leased.pieces() as u8); +} + /// The same writes into a `Vec` and a `BytesMut`, which must match, and through the /// impls forwarding through a `&mut` and a `Box`, whose provided `put` and `put_bytes` /// grow by `chunk_mut` instead: the bytes, and each vector's capacity. diff --git a/ts/fixtures/stock/src/harness.rs b/ts/fixtures/stock/src/harness.rs index 441621070..d1c8fb9f3 100644 --- a/ts/fixtures/stock/src/harness.rs +++ b/ts/fixtures/stock/src/harness.rs @@ -20,6 +20,7 @@ fn cases() -> Vec<(&'static str, Case)> { ("buf::writes", crate::buf::writes), ("buf::edits", crate::buf::edits), ("buf::reserves", crate::buf::reserves), + ("buf::dyns", crate::buf::dyns), ("maps::map", crate::maps::map), ("maps::table", crate::maps::table), ("maps::capacity", crate::maps::capacity), diff --git a/ts/runtime/rt/bytes.ts b/ts/runtime/rt/bytes.ts index 7fea23871..5a40feaa5 100644 --- a/ts/runtime/rt/bytes.ts +++ b/ts/runtime/rt/bytes.ts @@ -18,6 +18,9 @@ import { type Place, panic, type RangeInclusive, + type Result, + Err, + Ok, } from "../rt.ts"; import type { usize } from "./int.ts"; @@ -212,6 +215,57 @@ export function bufCopyToBytes( return bytesMutFreeze(out); } +/** `bytes::TryGetError`: what a `try_get_*` asked for, and what remained. */ +interface TryGetError { + requested: usize; + available: usize; +} + +/** + * `Buf::try_get_*` of an integer of `size` bytes as `bytes` provides it, of a buffer read + * through its own methods: an error if fewer remain, and else the integer `decode` makes of + * its bytes, the other way around if `le`, read from its chunk and then advanced past, or + * copied out by `copyToSlice` where the chunk holds fewer. + */ +export function bufTryGet( + src: B, + size: usize, + le: boolean, + decode: (bytes: Uint8Array) => T, + remaining: (src: B) => usize, + chunk: (src: B) => ByteSlice, + advance: (src: B, cnt: usize) => void, + copyToSlice: (src: B, dst: ByteSlice) => void, +): Result { + if (remaining(src) < size) return Err({ requested: size, available: remaining(src) }); + const c = chunk(src); + let bytes: Uint8Array; + if (c.length >= size) { + bytes = c.data.slice(c.start, c.start + size); + advance(src, size); + } else { + bytes = new Uint8Array(size); + copyToSlice(src, new ByteSlice(bytes, 0, size)); + } + return Ok(decode(le ? bytes.reverse() : bytes)); +} + +/** `Buf::get_*` as `bufTryGet` reads it, panicking where it fails. */ +export function bufGet( + src: B, + size: usize, + le: boolean, + decode: (bytes: Uint8Array) => T, + remaining: (src: B) => usize, + chunk: (src: B) => ByteSlice, + advance: (src: B, cnt: usize) => void, + copyToSlice: (src: B, dst: ByteSlice) => void, +): T { + const got = bufTryGet(src, size, le, decode, remaining, chunk, advance, copyToSlice); + if (!got.ok) panicAdvance(got.error.requested, got.error.available); + return got.value; +} + /** `Buf::get_*` of `Bytes`: its first `n` bytes, the other way around if `le`, read past. */ export function bytesRead(p: Place, n: usize, le: boolean): Uint8Array { const b = p.v; diff --git a/ts/src/lower/dynamic.rs b/ts/src/lower/dynamic.rs index 2d73493a2..cf6000ebe 100644 --- a/ts/src/lower/dynamic.rs +++ b/ts/src/lower/dynamic.rs @@ -110,7 +110,7 @@ impl<'tcx> Translator<'_, 'tcx> { return Some(object.clone()); } // A trait of a crate translated from source is as the crate's own. - if !self.own(principal) && !is_any(tcx, principal) { + if !self.own(principal) && !is_any(tcx, principal) && !is_buf(tcx, principal) { self.unrepresented( span, format!("`{ty}`, a trait object of another crate's trait, which is not supported yet"), @@ -150,6 +150,10 @@ impl<'tcx> Translator<'_, 'tcx> { // `Any`'s object is its class, which a downcast checks for, so it needs no method. for &tr in traits.iter().filter(|&&tr| !is_any(tcx, tr)) { for &def_id in tcx.own_existential_vtable_entries(tr) { + // `Buf::chunks_vectored`, whose `IoSlice` has no JS value. + if is_buf(tcx, tr) && tcx.item_name(def_id).as_str() == "chunks_vectored" { + continue; + } let name = format!("{}${}", super::camel(tcx.item_name(def_id).as_str()), tcx.item_name(tr)); if methods.iter().any(|m: &Method| m.name == name) { self.err(span, format!("`{ty}`, whose traits have two methods named `{name}`")); @@ -351,6 +355,14 @@ fn is_any(tcx: TyCtxt<'_>, def_id: DefId) -> bool { tcx.is_diagnostic_item(rustc_span::Symbol::intern("Any"), def_id) } +/// Whether `def_id` is `bytes`' `Buf`, whose provided methods translate from its MIR for +/// a buffer the mapping doesn't name. +fn is_buf(tcx: TyCtxt<'_>, def_id: DefId) -> bool { + super::stock::is_stock(tcx, def_id) + && tcx.crate_name(def_id.krate).as_str() == "bytes" + && tcx.item_name(def_id).as_str() == "Buf" +} + /// Whether `ty` is a `dyn Any`. pub fn is_any_object(tcx: TyCtxt<'_>, ty: Ty<'_>) -> bool { principal(ty).is_some_and(|p| is_any(tcx, p)) diff --git a/ts/src/lower/stock.rs b/ts/src/lower/stock.rs index 6b0ba7184..4b50115dc 100644 --- a/ts/src/lower/stock.rs +++ b/ts/src/lower/stock.rs @@ -96,10 +96,11 @@ pub fn maps<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> bool { } let name = tcx.item_name(did); let ty = instance.args.type_at(0); + let get = Get::of(name.as_str()); match mapped_self(tcx, ty) { - true => BUF.contains(&name.as_str()) || BUF_MUT.contains(&name.as_str()), + true => BUF.contains(&name.as_str()) || BUF_MUT.contains(&name.as_str()) || get.is_some_and(|g| g.fallible), false if Buffer::through(tcx, ty).is_some() => BUF_MUT.contains(&name.as_str()), - false => name.as_str() == "copy_to_bytes", + false => name.as_str() == "copy_to_bytes" || get.is_some(), } } @@ -376,6 +377,14 @@ fn bytes<'tcx>( _ => {} } let ty = targ(call.args, 0); + // What its MIR reads through a pointer cast: any buffer's `try_get_*` of a fixed size, + // and its `get_*` of one the mapping doesn't name. + if owner == "Buf" + && let Some(get) = Get::of(name) + && (get.fallible || Buffer::of(tcx, ty).is_none()) + { + return provided_get(b, call, ty, get, args); + } if owner == "BufMut" && let Some(buffer) = Buffer::through(tcx, ty) { @@ -713,6 +722,76 @@ fn provided_copy_to_bytes<'tcx>(b: &mut Body<'_, '_, 'tcx>, call: &Call<'tcx>, a Some(Expr::rt("bufCopyToBytes", vec![this, len, remaining, chunk, advance])) } +/// A provided `get_*` or `try_get_*` of `Buf` of an integer of a fixed size. +#[derive(Clone, Copy)] +struct Get { + /// `try_get_*`, which gives a `TryGetError` where `get_*` panics. + fallible: bool, + le: bool, +} + +impl Get { + fn of(name: &str) -> Option { + let (fallible, rest) = match name.strip_prefix("try_get_") { + Some(rest) => (true, rest), + None => (false, name.strip_prefix("get_")?), + }; + let (int, le) = scalar(rest); + ["u16", "i16", "u32", "i32", "u64", "i64", "u128", "i128"] + .contains(&int) + .then_some(Self { fallible, le }) + } +} + +/// `get` of the buffer `ty` as `bytes` provides it: `rt.bufGet` or `rt.bufTryGet` of its own +/// methods, which read its chunk where it holds the integer, or else copy it out. +fn provided_get<'tcx>( + b: &mut Body<'_, '_, 'tcx>, + call: &Call<'tcx>, + ty: Ty<'tcx>, + get: Get, + args: Vec, +) -> Option { + let this = args.into_iter().next()?; + let int = Int::of(match get.fallible { + true => { + let ty::Adt(_, result) = b.t.sig(call.def_id, call.args).output().kind() else { + return None; + }; + result.type_at(0) + } + false => b.t.sig(call.def_id, call.args).output(), + })?; + let mut values = vec![ + this, + Expr::lit((int.bits / 8).to_string()), + Expr::lit(get.le.to_string()), + int.func("fromBeBytes"), + ]; + for name in ["remaining", "chunk", "advance", "copy_to_slice"] { + values.push(buf_method_mut(b, call, ty, name)?); + } + let f = match get.fallible { + true => "bufTryGet", + false => "bufGet", + }; + Some(Expr::rt(f, values)) +} + +/// `Buf`'s method `name` for `ty`, taking the buffer as a `&mut` to it is: through the +/// `rt.Place` of one JS copies for a `&self` method. +fn buf_method_mut<'tcx>(b: &mut Body<'_, '_, 'tcx>, call: &Call<'tcx>, ty: Ty<'tcx>, name: &str) -> Option { + let f = buf_method(b, call, ty, name)?; + if !b.t.needs_place(ty) || matches!(name, "advance" | "copy_to_slice") { + return Some(f); + } + let param = crate::ts::Param { + name: "p".into(), + ty: Some(crate::ts::Type::Rt("Place", vec![b.t.ty(ty, call.span)])), + }; + Some(Expr::Lambda(vec![param], Box::new(f.call(vec![Expr::ident("p").member("v")])))) +} + /// The function value of `Buf`'s method `name` for the buffer `ty`, of the crate `call` is to. fn buf_method<'tcx>(b: &mut Body<'_, '_, 'tcx>, call: &Call<'tcx>, ty: Ty<'tcx>, name: &str) -> Option { let tcx = b.t.tcx; From 7e4f92b6919a78182cab0312dab077eea18b478c Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:16:32 -0800 Subject: [PATCH 2/3] style(ts): format buf_method_mut Co-Authored-By: Claude Opus 5.5 --- ts/src/lower/stock.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ts/src/lower/stock.rs b/ts/src/lower/stock.rs index 4b50115dc..d5a288078 100644 --- a/ts/src/lower/stock.rs +++ b/ts/src/lower/stock.rs @@ -789,7 +789,10 @@ fn buf_method_mut<'tcx>(b: &mut Body<'_, '_, 'tcx>, call: &Call<'tcx>, ty: Ty<'t name: "p".into(), ty: Some(crate::ts::Type::Rt("Place", vec![b.t.ty(ty, call.span)])), }; - Some(Expr::Lambda(vec![param], Box::new(f.call(vec![Expr::ident("p").member("v")])))) + Some(Expr::Lambda( + vec![param], + Box::new(f.call(vec![Expr::ident("p").member("v")])), + )) } /// The function value of `Buf`'s method `name` for the buffer `ty`, of the crate `call` is to. From af01e4ce18d4d4985f5007d274d05965765e1c3f Mon Sep 17 00:00:00 2001 From: quest fixer Date: Mon, 2 Nov 2026 11:45:48 -0800 Subject: [PATCH 3/3] Regenerate stock snapshots for Counted namespace collision --- ts/fixtures/stock/expected/buf.Leased.ts | 30 +- ts/fixtures/stock/expected/buf.Pieces.ts | 28 +- ts/fixtures/stock/expected/buf.Provided.ts | 26 +- ts/fixtures/stock/expected/buf.ts | 36 +- .../stock/expected/bytes/buf/buf_impl.Buf.ts | 424 +++++++++--------- .../stock/expected/bytes/buf/buf_impl.ts | 86 ++-- .../stock/expected/bytes/buf/take.Take.ts | 26 +- ts/fixtures/stock/expected/maps.ts | 6 +- 8 files changed, 331 insertions(+), 331 deletions(-) diff --git a/ts/fixtures/stock/expected/buf.Leased.ts b/ts/fixtures/stock/expected/buf.Leased.ts index 3d5f83cb3..4ad58d5c1 100644 --- a/ts/fixtures/stock/expected/buf.Leased.ts +++ b/ts/fixtures/stock/expected/buf.Leased.ts @@ -1,7 +1,7 @@ // Generated by rust2-ts. Do not edit. import * as rt from "./rt.ts"; -import * as Counted from "./buf.Counted.ts"; +import * as buf_Counted from "./buf.Counted.ts"; import * as Pieces from "./buf.Pieces.ts"; import type * as TryGetError from "./bytes.TryGetError.ts"; @@ -202,37 +202,37 @@ export class of$buf_Pieces { tryGetF32$Buf(): rt.Result { const part = Pieces.tryGetF32$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Le$Buf(): rt.Result { const part = Pieces.tryGetF32Le$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Ne$Buf(): rt.Result { const part = Pieces.tryGetF32Ne$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64$Buf(): rt.Result { const part = Pieces.tryGetF64$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Le$Buf(): rt.Result { const part = Pieces.tryGetF64Le$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Ne$Buf(): rt.Result { const part = Pieces.tryGetF64Ne$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -286,25 +286,25 @@ export class of$buf_Pieces { tryGetI8$Buf(): rt.Result { const part = Pieces.tryGetI8$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetInt$Buf(a: rt.usize): rt.Result { const part = Pieces.tryGetInt$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntLe$Buf(a: rt.usize): rt.Result { const part = Pieces.tryGetIntLe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntNe$Buf(a: rt.usize): rt.Result { const part = Pieces.tryGetIntNe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -358,25 +358,25 @@ export class of$buf_Pieces { tryGetU8$Buf(): rt.Result { const part = Pieces.tryGetU8$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUint$Buf(a: rt.usize): rt.Result { const part = Pieces.tryGetUint$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintLe$Buf(a: rt.usize): rt.Result { const part = Pieces.tryGetUintLe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintNe$Buf(a: rt.usize): rt.Result { const part = Pieces.tryGetUintNe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } } diff --git a/ts/fixtures/stock/expected/buf.Pieces.ts b/ts/fixtures/stock/expected/buf.Pieces.ts index 301a5d94c..e242742df 100644 --- a/ts/fixtures/stock/expected/buf.Pieces.ts +++ b/ts/fixtures/stock/expected/buf.Pieces.ts @@ -1,7 +1,7 @@ // Generated by rust2-ts. Do not edit. import * as rt from "./rt.ts"; -import * as Counted from "./buf.Counted.ts"; +import * as buf_Counted from "./buf.Counted.ts"; import { panicAdvance, panicDoesNotFit } from "./bytes.ts"; import { signExtend } from "./bytes/buf/buf_impl.ts"; import type * as TryGetError from "./bytes.TryGetError.ts"; @@ -687,7 +687,7 @@ export function tryGetU8$bytes_Buf(self: Pieces): rt.u8 | undefined { advance$bytes_Buf(self, 1); return ret; } - Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut(self) }; + buf_Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut(self) }; return undefined; } @@ -724,7 +724,7 @@ export function tryGetI8$bytes_Buf(self: Pieces): rt.i8 | undefined { advance$bytes_Buf(self, 1); return ret; } - Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut(self) }; + buf_Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut(self) }; return undefined; } @@ -769,7 +769,7 @@ export function tryGetUint$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.u64 | u if (_8.ok) { return rt.u64FromBeBytes(buf); } - Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -814,7 +814,7 @@ export function tryGetUintLe$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.u64 | if (_11.ok) { return rt.u64FromBeBytes(buf.slice().reverse()); } - Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -900,7 +900,7 @@ export function tryGetInt$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.i64 | un if (_8.ok) { return rt.i64FromBeBytes(buf); } - Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -945,7 +945,7 @@ export function tryGetIntLe$bytes_Buf(self: Pieces, nbytes: rt.usize): rt.i64 | if (_11.ok) { return rt.i64FromBeBytes(buf.slice().reverse()); } - Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -1022,7 +1022,7 @@ export function tryGetF32$bytes_Buf(self: Pieces): rt.f32 | undefined { if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1058,7 +1058,7 @@ export function tryGetF32Le$bytes_Buf(self: Pieces): rt.f32 | undefined { if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1097,7 +1097,7 @@ export function tryGetF32Ne$bytes_Buf(self: Pieces): rt.f32 | undefined { if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1133,7 +1133,7 @@ export function tryGetF64$bytes_Buf(self: Pieces): rt.f64 | undefined { if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1169,7 +1169,7 @@ export function tryGetF64Le$bytes_Buf(self: Pieces): rt.f64 | undefined { if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1208,7 +1208,7 @@ export function tryGetF64Ne$bytes_Buf(self: Pieces): rt.f64 | undefined { if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1783,7 +1783,7 @@ export function remaining$bytes_Buf_mut_mut(self: rt.Place): rt.usize { export function tryGetI64Le$bytes_Buf_mut(self: rt.Place): rt.i64 | undefined { const _0: rt.Result = rt.bufTryGet(self.v, 8, true, rt.i64FromBeBytes, remaining$bytes_Buf, chunk$bytes_Buf, advance$bytes_Buf as (a0: Pieces, a1: rt.usize) => undefined, copyToSlice$bytes_Buf as (a0: Pieces, a1: rt.ByteSlice) => undefined); if (!_0.ok) { - Counted.tryGetIntOut$bytes_Buf.err = _0.error; + buf_Counted.tryGetIntOut$bytes_Buf.err = _0.error; return undefined; } return _0.value; diff --git a/ts/fixtures/stock/expected/buf.Provided.ts b/ts/fixtures/stock/expected/buf.Provided.ts index f8d7cb186..52f09adbb 100644 --- a/ts/fixtures/stock/expected/buf.Provided.ts +++ b/ts/fixtures/stock/expected/buf.Provided.ts @@ -1,7 +1,7 @@ // Generated by rust2-ts. Do not edit. import * as rt from "./rt.ts"; -import * as Counted from "./buf.Counted.ts"; +import * as buf_Counted from "./buf.Counted.ts"; import * as Pieces from "./buf.Pieces.ts"; import { panicAdvance, panicDoesNotFit } from "./bytes.ts"; import { signExtend } from "./bytes/buf/buf_impl.ts"; @@ -623,7 +623,7 @@ export function tryGetU8$bytes_Buf(self: Provided): rt.u8 | undefined { advance$bytes_Buf(self, 1); return ret; } - Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut(self) }; + buf_Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut(self) }; return undefined; } @@ -660,7 +660,7 @@ export function tryGetI8$bytes_Buf(self: Provided): rt.i8 | undefined { advance$bytes_Buf(self, 1); return ret; } - Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut(self) }; + buf_Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut(self) }; return undefined; } @@ -705,7 +705,7 @@ export function tryGetUint$bytes_Buf(self: Provided, nbytes: rt.usize): rt.u64 | if (_8.ok) { return rt.u64FromBeBytes(buf); } - Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -750,7 +750,7 @@ export function tryGetUintLe$bytes_Buf(self: Provided, nbytes: rt.usize): rt.u64 if (_11.ok) { return rt.u64FromBeBytes(buf.slice().reverse()); } - Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -836,7 +836,7 @@ export function tryGetInt$bytes_Buf(self: Provided, nbytes: rt.usize): rt.i64 | if (_8.ok) { return rt.i64FromBeBytes(buf); } - Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -881,7 +881,7 @@ export function tryGetIntLe$bytes_Buf(self: Provided, nbytes: rt.usize): rt.i64 if (_11.ok) { return rt.i64FromBeBytes(buf.slice().reverse()); } - Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -958,7 +958,7 @@ export function tryGetF32$bytes_Buf(self: Provided): rt.f32 | undefined { if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -994,7 +994,7 @@ export function tryGetF32Le$bytes_Buf(self: Provided): rt.f32 | undefined { if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1033,7 +1033,7 @@ export function tryGetF32Ne$bytes_Buf(self: Provided): rt.f32 | undefined { if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1069,7 +1069,7 @@ export function tryGetF64$bytes_Buf(self: Provided): rt.f64 | undefined { if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1105,7 +1105,7 @@ export function tryGetF64Le$bytes_Buf(self: Provided): rt.f64 | undefined { if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1144,7 +1144,7 @@ export function tryGetF64Ne$bytes_Buf(self: Provided): rt.f64 | undefined { if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } diff --git a/ts/fixtures/stock/expected/buf.ts b/ts/fixtures/stock/expected/buf.ts index 58877d4bf..1206b96e5 100644 --- a/ts/fixtures/stock/expected/buf.ts +++ b/ts/fixtures/stock/expected/buf.ts @@ -1,7 +1,7 @@ // Generated by rust2-ts. Do not edit. import * as rt from "./rt.ts"; -import * as Counted from "./buf.Counted.ts"; +import * as buf_Counted from "./buf.Counted.ts"; import * as Leased from "./buf.Leased.ts"; import * as Ops from "./buf.Ops.ts"; import * as Pieces from "./buf.Pieces.ts"; @@ -162,7 +162,7 @@ export function read$boxed_Box_dyn_bytes_Buf(buf: rt.Place, n: rt.usize } if (_4 === 16) { const part6: rt.i64 | undefined = tryGetI64Le$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf); - const err3: TryGetError.TryGetError | undefined = part6 === undefined ? Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err3: TryGetError.TryGetError | undefined = part6 === undefined ? buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; const part7 = result_map$0c3nzkx((err3 !== undefined ? rt.Err(err3 as TryGetError.TryGetError) : rt.Ok(part6 as rt.i64)) as rt.Result, (v2: rt.i64): rt.u128 => { return rt.u128Cast(v2); }); @@ -176,7 +176,7 @@ export function read$boxed_Box_dyn_bytes_Buf(buf: rt.Place, n: rt.usize } if (_4 === 18) { const part3: rt.u8 | undefined = tryGetU8$bytes_Buf_boxed_Box_dyn_bytes_Buf(buf); - const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err: TryGetError.TryGetError | undefined = part3 === undefined ? buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { return a0 as rt.u128; }); @@ -261,7 +261,7 @@ export function read$buf_Pieces(buf: Pieces.Pieces, n: rt.usize): rt.u128 { } if (_4 === 18) { const part3: rt.u8 | undefined = Pieces.tryGetU8$bytes_Buf(buf); - const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err: TryGetError.TryGetError | undefined = part3 === undefined ? buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a033: rt.u8): rt.u128 => { return a033 as rt.u128; }); @@ -346,7 +346,7 @@ export function read$buf_Provided(buf: Provided.Provided, n: rt.usize): rt.u128 } if (_4 === 18) { const part3: rt.u8 | undefined = Provided.tryGetU8$bytes_Buf(buf); - const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err: TryGetError.TryGetError | undefined = part3 === undefined ? buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a033: rt.u8): rt.u128 => { return a033 as rt.u128; }); @@ -455,7 +455,7 @@ export function read$bytes_Bytes(buf: rt.Place, n: rt.usize): rt.u } if (_4 === 18) { const part3: rt.u8 | undefined = tryGetU8$bytes_Buf_bytes_Bytes(buf); - const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err: TryGetError.TryGetError | undefined = part3 === undefined ? buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { return a0 as rt.u128; }); @@ -564,7 +564,7 @@ export function read$bytes_BytesMut(buf: rt.BytesMut, n: rt.usize): rt.u128 { } if (_4 === 18) { const part3: rt.u8 | undefined = tryGetU8$bytes_Buf_bytes_BytesMut(buf); - const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err: TryGetError.TryGetError | undefined = part3 === undefined ? buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { return a0 as rt.u128; }); @@ -649,7 +649,7 @@ export function read$bytes_buf_Take_bytes_Bytes(buf: Take.Take, n: } if (_4 === 18) { const part3: rt.u8 | undefined = Take.tryGetU8$bytes_Buf_bytes_Bytes(buf); - const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err: TryGetError.TryGetError | undefined = part3 === undefined ? buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a033: rt.u8): rt.u128 => { return a033 as rt.u128; }); @@ -892,7 +892,7 @@ export function read$mut_buf_Pieces(buf: rt.Place, n: rt.usize): } if (_4 === 16) { const part6: rt.i64 | undefined = Pieces.tryGetI64Le$bytes_Buf_mut(buf); - const err3: TryGetError.TryGetError | undefined = part6 === undefined ? Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err3: TryGetError.TryGetError | undefined = part6 === undefined ? buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; const part7 = result_map$0c3nzkx((err3 !== undefined ? rt.Err(err3 as TryGetError.TryGetError) : rt.Ok(part6 as rt.i64)) as rt.Result, (v2: rt.i64): rt.u128 => { return rt.u128Cast(v2); }); @@ -906,7 +906,7 @@ export function read$mut_buf_Pieces(buf: rt.Place, n: rt.usize): } if (_4 === 18) { const part3: rt.u8 | undefined = Pieces.tryGetU8$bytes_Buf_mut(buf); - const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err: TryGetError.TryGetError | undefined = part3 === undefined ? buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { return a0 as rt.u128; }); @@ -983,7 +983,7 @@ export function read$mut_bytes_Bytes(buf: rt.Place>, n: r } if (_4 === 16) { const part6: rt.i64 | undefined = tryGetI64Le$bytes_Buf_mut_bytes_Bytes(buf); - const err3: TryGetError.TryGetError | undefined = part6 === undefined ? Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err3: TryGetError.TryGetError | undefined = part6 === undefined ? buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; const part7 = result_map$0c3nzkx((err3 !== undefined ? rt.Err(err3 as TryGetError.TryGetError) : rt.Ok(part6 as rt.i64)) as rt.Result, (v2: rt.i64): rt.u128 => { return rt.u128Cast(v2); }); @@ -997,7 +997,7 @@ export function read$mut_bytes_Bytes(buf: rt.Place>, n: r } if (_4 === 18) { const part3: rt.u8 | undefined = tryGetU8$bytes_Buf_mut_bytes_Bytes(buf); - const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err: TryGetError.TryGetError | undefined = part3 === undefined ? buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { return a0 as rt.u128; }); @@ -1074,7 +1074,7 @@ export function read$mut_dyn_bytes_Buf(buf: rt.Place, n: rt.usize): rt. } if (_4 === 16) { const part6: rt.i64 | undefined = tryGetI64Le$bytes_Buf_mut_dyn_bytes_Buf(buf); - const err3: TryGetError.TryGetError | undefined = part6 === undefined ? Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err3: TryGetError.TryGetError | undefined = part6 === undefined ? buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; const part7 = result_map$0c3nzkx((err3 !== undefined ? rt.Err(err3 as TryGetError.TryGetError) : rt.Ok(part6 as rt.i64)) as rt.Result, (v2: rt.i64): rt.u128 => { return rt.u128Cast(v2); }); @@ -1088,7 +1088,7 @@ export function read$mut_dyn_bytes_Buf(buf: rt.Place, n: rt.usize): rt. } if (_4 === 18) { const part3: rt.u8 | undefined = tryGetU8$bytes_Buf_mut_dyn_bytes_Buf(buf); - const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err: TryGetError.TryGetError | undefined = part3 === undefined ? buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { return a0 as rt.u128; }); @@ -1165,7 +1165,7 @@ export function read$mut_ref_slice_u8(buf: rt.Place>, n: } if (_4 === 16) { const part6: rt.i64 | undefined = tryGetI64Le$bytes_Buf_mut_ref_slice_u8(buf); - const err3: TryGetError.TryGetError | undefined = part6 === undefined ? Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err3: TryGetError.TryGetError | undefined = part6 === undefined ? buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError : undefined; const part7 = result_map$0c3nzkx((err3 !== undefined ? rt.Err(err3 as TryGetError.TryGetError) : rt.Ok(part6 as rt.i64)) as rt.Result, (v2: rt.i64): rt.u128 => { return rt.u128Cast(v2); }); @@ -1179,7 +1179,7 @@ export function read$mut_ref_slice_u8(buf: rt.Place>, n: } if (_4 === 18) { const part3: rt.u8 | undefined = tryGetU8$bytes_Buf_mut_ref_slice_u8(buf); - const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err: TryGetError.TryGetError | undefined = part3 === undefined ? buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { return a0 as rt.u128; }); @@ -1288,7 +1288,7 @@ export function read$ref_slice_u8(buf: rt.Place, n: rt.usize): rt. } if (_4 === 18) { const part3: rt.u8 | undefined = tryGetU8$bytes_Buf_ref_slice_u8(buf); - const err: TryGetError.TryGetError | undefined = part3 === undefined ? Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; + const err: TryGetError.TryGetError | undefined = part3 === undefined ? buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError : undefined; const part4 = result_map$01kzrm1((err !== undefined ? rt.Err(err as TryGetError.TryGetError) : rt.Ok(part3 as rt.u8)) as rt.Result, (a0: rt.u8): rt.u128 => { return a0 as rt.u128; }); @@ -1658,7 +1658,7 @@ export function dyns(dataData: Uint8Array, dataStart: number, dataLen: number, o const drops: rt.Arc> = new rt.Arc(new rt.Cell(0)); const _59: rt.u8 = rt.u8Rem(dataData[dataStart], 3); if (_59 === 0) { - _58 = new Buf.of$buf_Counted(new Counted.Counted(Pieces.new(input.data, input.start, input.length, cut), rt.arcClone(drops))); + _58 = new Buf.of$buf_Counted(new buf_Counted.Counted(Pieces.new(input.data, input.start, input.length, cut), rt.arcClone(drops))); } else if (_59 === 1) { _58 = new Buf.of$bytes_Bytes(rt.bytesCopyFromSlice(input)); } else { diff --git a/ts/fixtures/stock/expected/bytes/buf/buf_impl.Buf.ts b/ts/fixtures/stock/expected/bytes/buf/buf_impl.Buf.ts index 416ce9f50..80cdad170 100644 --- a/ts/fixtures/stock/expected/bytes/buf/buf_impl.Buf.ts +++ b/ts/fixtures/stock/expected/bytes/buf/buf_impl.Buf.ts @@ -1,7 +1,7 @@ // Generated by rust2-ts. Do not edit. import * as rt from "../../rt.ts"; -import * as Counted from "../../buf.Counted.ts"; +import * as buf_Counted from "../../buf.Counted.ts"; import * as Pieces from "../../buf.Pieces.ts"; import * as Provided from "../../buf.Provided.ts"; import { tryCopyToSlice$bytes_Buf_bytes_Bytes, tryCopyToSlice$bytes_Buf_bytes_BytesMut, tryCopyToSlice$bytes_Buf_ref_slice_u8, tryGetU8$bytes_Buf_bytes_Bytes, tryGetU8$bytes_Buf_bytes_BytesMut, tryGetU8$bytes_Buf_ref_slice_u8, tryGetI8$bytes_Buf_bytes_Bytes, tryGetI8$bytes_Buf_bytes_BytesMut, tryGetI8$bytes_Buf_ref_slice_u8, tryGetUint$bytes_Buf_bytes_Bytes, tryGetUint$bytes_Buf_bytes_BytesMut, tryGetUint$bytes_Buf_ref_slice_u8, tryGetUintLe$bytes_Buf_bytes_Bytes, tryGetUintLe$bytes_Buf_bytes_BytesMut, tryGetUintLe$bytes_Buf_ref_slice_u8, tryGetUintNe$bytes_Buf_bytes_Bytes, tryGetUintNe$bytes_Buf_bytes_BytesMut, tryGetUintNe$bytes_Buf_ref_slice_u8, tryGetInt$bytes_Buf_bytes_Bytes, tryGetInt$bytes_Buf_bytes_BytesMut, tryGetInt$bytes_Buf_ref_slice_u8, tryGetIntLe$bytes_Buf_bytes_Bytes, tryGetIntLe$bytes_Buf_bytes_BytesMut, tryGetIntLe$bytes_Buf_ref_slice_u8, tryGetIntNe$bytes_Buf_bytes_Bytes, tryGetIntNe$bytes_Buf_bytes_BytesMut, tryGetIntNe$bytes_Buf_ref_slice_u8, tryGetF32$bytes_Buf_bytes_Bytes, tryGetF32$bytes_Buf_bytes_BytesMut, tryGetF32$bytes_Buf_ref_slice_u8, tryGetF32Le$bytes_Buf_bytes_Bytes, tryGetF32Le$bytes_Buf_bytes_BytesMut, tryGetF32Le$bytes_Buf_ref_slice_u8, tryGetF32Ne$bytes_Buf_bytes_Bytes, tryGetF32Ne$bytes_Buf_bytes_BytesMut, tryGetF32Ne$bytes_Buf_ref_slice_u8, tryGetF64$bytes_Buf_bytes_Bytes, tryGetF64$bytes_Buf_bytes_BytesMut, tryGetF64$bytes_Buf_ref_slice_u8, tryGetF64Le$bytes_Buf_bytes_Bytes, tryGetF64Le$bytes_Buf_bytes_BytesMut, tryGetF64Le$bytes_Buf_ref_slice_u8, tryGetF64Ne$bytes_Buf_bytes_Bytes, tryGetF64Ne$bytes_Buf_bytes_BytesMut, tryGetF64Ne$bytes_Buf_ref_slice_u8 } from "../../bytes/buf/buf_impl.ts"; @@ -38,9 +38,9 @@ export type Buf = | { remaining$Buf: () => rt.usize; chunk$Buf: () => rt.ByteSlice; advance$Buf: (a0: rt.usize) => void; hasRemaining$Buf: () => boolean; copyToSlice$Buf: (a0: rt.ByteSlice) => void; getU8$Buf: () => rt.u8; getI8$Buf: () => rt.i8; getU16$Buf: () => rt.u16; getU16Le$Buf: () => rt.u16; getU16Ne$Buf: () => rt.u16; getI16$Buf: () => rt.i16; getI16Le$Buf: () => rt.i16; getI16Ne$Buf: () => rt.i16; getU32$Buf: () => rt.u32; getU32Le$Buf: () => rt.u32; getU32Ne$Buf: () => rt.u32; getI32$Buf: () => rt.i32; getI32Le$Buf: () => rt.i32; getI32Ne$Buf: () => rt.i32; getU64$Buf: () => rt.u64; getU64Le$Buf: () => rt.u64; getU64Ne$Buf: () => rt.u64; getI64$Buf: () => rt.i64; getI64Le$Buf: () => rt.i64; getI64Ne$Buf: () => rt.i64; getU128$Buf: () => rt.u128; getU128Le$Buf: () => rt.u128; getU128Ne$Buf: () => rt.u128; getI128$Buf: () => rt.i128; getI128Le$Buf: () => rt.i128; getI128Ne$Buf: () => rt.i128; getUint$Buf: (a0: rt.usize) => rt.u64; getUintLe$Buf: (a0: rt.usize) => rt.u64; getUintNe$Buf: (a0: rt.usize) => rt.u64; getInt$Buf: (a0: rt.usize) => rt.i64; getIntLe$Buf: (a0: rt.usize) => rt.i64; getIntNe$Buf: (a0: rt.usize) => rt.i64; getF32$Buf: () => rt.f32; getF32Le$Buf: () => rt.f32; getF32Ne$Buf: () => rt.f32; getF64$Buf: () => rt.f64; getF64Le$Buf: () => rt.f64; getF64Ne$Buf: () => rt.f64; tryCopyToSlice$Buf: (a0: rt.ByteSlice) => rt.Result; tryGetU8$Buf: () => rt.Result; tryGetI8$Buf: () => rt.Result; tryGetU16$Buf: () => rt.Result; tryGetU16Le$Buf: () => rt.Result; tryGetU16Ne$Buf: () => rt.Result; tryGetI16$Buf: () => rt.Result; tryGetI16Le$Buf: () => rt.Result; tryGetI16Ne$Buf: () => rt.Result; tryGetU32$Buf: () => rt.Result; tryGetU32Le$Buf: () => rt.Result; tryGetU32Ne$Buf: () => rt.Result; tryGetI32$Buf: () => rt.Result; tryGetI32Le$Buf: () => rt.Result; tryGetI32Ne$Buf: () => rt.Result; tryGetU64$Buf: () => rt.Result; tryGetU64Le$Buf: () => rt.Result; tryGetU64Ne$Buf: () => rt.Result; tryGetI64$Buf: () => rt.Result; tryGetI64Le$Buf: () => rt.Result; tryGetI64Ne$Buf: () => rt.Result; tryGetU128$Buf: () => rt.Result; tryGetU128Le$Buf: () => rt.Result; tryGetU128Ne$Buf: () => rt.Result; tryGetI128$Buf: () => rt.Result; tryGetI128Le$Buf: () => rt.Result; tryGetI128Ne$Buf: () => rt.Result; tryGetUint$Buf: (a0: rt.usize) => rt.Result; tryGetUintLe$Buf: (a0: rt.usize) => rt.Result; tryGetUintNe$Buf: (a0: rt.usize) => rt.Result; tryGetInt$Buf: (a0: rt.usize) => rt.Result; tryGetIntLe$Buf: (a0: rt.usize) => rt.Result; tryGetIntNe$Buf: (a0: rt.usize) => rt.Result; tryGetF32$Buf: () => rt.Result; tryGetF32Le$Buf: () => rt.Result; tryGetF32Ne$Buf: () => rt.Result; tryGetF64$Buf: () => rt.Result; tryGetF64Le$Buf: () => rt.Result; tryGetF64Ne$Buf: () => rt.Result; copyToBytes$Buf: (a0: rt.usize) => rt.ByteSlice }; export class of$buf_Counted { - v: Counted.Counted; + v: buf_Counted.Counted; - constructor(v: Counted.Counted) { + constructor(v: buf_Counted.Counted) { this.v = v; } @@ -49,362 +49,362 @@ export class of$buf_Counted { } advance$Buf(a: rt.usize): void { - return Counted.advance$bytes_Buf(this.v, a); + return buf_Counted.advance$bytes_Buf(this.v, a); } chunk$Buf(): rt.ByteSlice { - return Counted.chunk$bytes_Buf(this.v); + return buf_Counted.chunk$bytes_Buf(this.v); } copyToBytes$Buf(a: rt.usize): rt.ByteSlice { - return rt.bufCopyToBytes(this.v, a, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined); + return rt.bufCopyToBytes(this.v, a, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined); } copyToSlice$Buf(a: rt.ByteSlice): void { - return Counted.copyToSlice$bytes_Buf(this.v, a); + return buf_Counted.copyToSlice$bytes_Buf(this.v, a); } getF32$Buf(): rt.f32 { - return Counted.getF32$bytes_Buf(this.v); + return buf_Counted.getF32$bytes_Buf(this.v); } getF32Le$Buf(): rt.f32 { - return Counted.getF32Le$bytes_Buf(this.v); + return buf_Counted.getF32Le$bytes_Buf(this.v); } getF32Ne$Buf(): rt.f32 { - return Counted.getF32Ne$bytes_Buf(this.v); + return buf_Counted.getF32Ne$bytes_Buf(this.v); } getF64$Buf(): rt.f64 { - return Counted.getF64$bytes_Buf(this.v); + return buf_Counted.getF64$bytes_Buf(this.v); } getF64Le$Buf(): rt.f64 { - return Counted.getF64Le$bytes_Buf(this.v); + return buf_Counted.getF64Le$bytes_Buf(this.v); } getF64Ne$Buf(): rt.f64 { - return Counted.getF64Ne$bytes_Buf(this.v); + return buf_Counted.getF64Ne$bytes_Buf(this.v); } getI128$Buf(): rt.i128 { - return rt.bufGet(this.v, 16, false, rt.i128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 16, false, rt.i128FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getI128Le$Buf(): rt.i128 { - return rt.bufGet(this.v, 16, true, rt.i128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 16, true, rt.i128FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getI128Ne$Buf(): rt.i128 { - return rt.bufGet(this.v, 16, true, rt.i128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 16, true, rt.i128FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getI16$Buf(): rt.i16 { - return rt.bufGet(this.v, 2, false, rt.i16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 2, false, rt.i16FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getI16Le$Buf(): rt.i16 { - return rt.bufGet(this.v, 2, true, rt.i16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 2, true, rt.i16FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getI16Ne$Buf(): rt.i16 { - return rt.bufGet(this.v, 2, true, rt.i16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 2, true, rt.i16FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getI32$Buf(): rt.i32 { - return rt.bufGet(this.v, 4, false, rt.i32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 4, false, rt.i32FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getI32Le$Buf(): rt.i32 { - return rt.bufGet(this.v, 4, true, rt.i32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 4, true, rt.i32FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getI32Ne$Buf(): rt.i32 { - return rt.bufGet(this.v, 4, true, rt.i32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 4, true, rt.i32FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getI64$Buf(): rt.i64 { - return rt.bufGet(this.v, 8, false, rt.i64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 8, false, rt.i64FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getI64Le$Buf(): rt.i64 { - return rt.bufGet(this.v, 8, true, rt.i64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 8, true, rt.i64FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getI64Ne$Buf(): rt.i64 { - return rt.bufGet(this.v, 8, true, rt.i64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 8, true, rt.i64FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getI8$Buf(): rt.i8 { - return Counted.getI8$bytes_Buf(this.v); + return buf_Counted.getI8$bytes_Buf(this.v); } getInt$Buf(a: rt.usize): rt.i64 { - return Counted.getInt$bytes_Buf(this.v, a); + return buf_Counted.getInt$bytes_Buf(this.v, a); } getIntLe$Buf(a: rt.usize): rt.i64 { - return Counted.getIntLe$bytes_Buf(this.v, a); + return buf_Counted.getIntLe$bytes_Buf(this.v, a); } getIntNe$Buf(a: rt.usize): rt.i64 { - return Counted.getIntNe$bytes_Buf(this.v, a); + return buf_Counted.getIntNe$bytes_Buf(this.v, a); } getU128$Buf(): rt.u128 { - return rt.bufGet(this.v, 16, false, rt.u128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 16, false, rt.u128FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getU128Le$Buf(): rt.u128 { - return rt.bufGet(this.v, 16, true, rt.u128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 16, true, rt.u128FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getU128Ne$Buf(): rt.u128 { - return rt.bufGet(this.v, 16, true, rt.u128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 16, true, rt.u128FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getU16$Buf(): rt.u16 { - return rt.bufGet(this.v, 2, false, rt.u16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 2, false, rt.u16FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getU16Le$Buf(): rt.u16 { - return rt.bufGet(this.v, 2, true, rt.u16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 2, true, rt.u16FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getU16Ne$Buf(): rt.u16 { - return rt.bufGet(this.v, 2, true, rt.u16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 2, true, rt.u16FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getU32$Buf(): rt.u32 { - return rt.bufGet(this.v, 4, false, rt.u32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 4, false, rt.u32FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getU32Le$Buf(): rt.u32 { - return rt.bufGet(this.v, 4, true, rt.u32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 4, true, rt.u32FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getU32Ne$Buf(): rt.u32 { - return rt.bufGet(this.v, 4, true, rt.u32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 4, true, rt.u32FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getU64$Buf(): rt.u64 { - return rt.bufGet(this.v, 8, false, rt.u64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 8, false, rt.u64FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getU64Le$Buf(): rt.u64 { - return rt.bufGet(this.v, 8, true, rt.u64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 8, true, rt.u64FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getU64Ne$Buf(): rt.u64 { - return rt.bufGet(this.v, 8, true, rt.u64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufGet(this.v, 8, true, rt.u64FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } getU8$Buf(): rt.u8 { - return Counted.getU8$bytes_Buf(this.v); + return buf_Counted.getU8$bytes_Buf(this.v); } getUint$Buf(a: rt.usize): rt.u64 { - return Counted.getUint$bytes_Buf(this.v, a); + return buf_Counted.getUint$bytes_Buf(this.v, a); } getUintLe$Buf(a: rt.usize): rt.u64 { - return Counted.getUintLe$bytes_Buf(this.v, a); + return buf_Counted.getUintLe$bytes_Buf(this.v, a); } getUintNe$Buf(a: rt.usize): rt.u64 { - return Counted.getUintNe$bytes_Buf(this.v, a); + return buf_Counted.getUintNe$bytes_Buf(this.v, a); } hasRemaining$Buf(): boolean { - return Counted.hasRemaining$bytes_Buf(this.v); + return buf_Counted.hasRemaining$bytes_Buf(this.v); } remaining$Buf(): rt.usize { - return Counted.remaining$bytes_Buf(this.v); + return buf_Counted.remaining$bytes_Buf(this.v); } tryCopyToSlice$Buf(a: rt.ByteSlice): rt.Result { - return Counted.tryCopyToSlice$bytes_Buf(this.v, a); + return buf_Counted.tryCopyToSlice$bytes_Buf(this.v, a); } tryGetF32$Buf(): rt.Result { - const part = Counted.tryGetF32$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const part = buf_Counted.tryGetF32$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Le$Buf(): rt.Result { - const part = Counted.tryGetF32Le$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const part = buf_Counted.tryGetF32Le$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Ne$Buf(): rt.Result { - const part = Counted.tryGetF32Ne$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const part = buf_Counted.tryGetF32Ne$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64$Buf(): rt.Result { - const part = Counted.tryGetF64$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const part = buf_Counted.tryGetF64$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Le$Buf(): rt.Result { - const part = Counted.tryGetF64Le$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const part = buf_Counted.tryGetF64Le$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Ne$Buf(): rt.Result { - const part = Counted.tryGetF64Ne$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const part = buf_Counted.tryGetF64Ne$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetI128$Buf(): rt.Result { - return rt.bufTryGet(this.v, 16, false, rt.i128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 16, false, rt.i128FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetI128Le$Buf(): rt.Result { - return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetI128Ne$Buf(): rt.Result { - return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 16, true, rt.i128FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetI16$Buf(): rt.Result { - return rt.bufTryGet(this.v, 2, false, rt.i16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 2, false, rt.i16FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetI16Le$Buf(): rt.Result { - return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetI16Ne$Buf(): rt.Result { - return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 2, true, rt.i16FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetI32$Buf(): rt.Result { - return rt.bufTryGet(this.v, 4, false, rt.i32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 4, false, rt.i32FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetI32Le$Buf(): rt.Result { - return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetI32Ne$Buf(): rt.Result { - return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 4, true, rt.i32FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetI64$Buf(): rt.Result { - return rt.bufTryGet(this.v, 8, false, rt.i64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 8, false, rt.i64FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetI64Le$Buf(): rt.Result { - return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetI64Ne$Buf(): rt.Result { - return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 8, true, rt.i64FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetI8$Buf(): rt.Result { - const part = Counted.tryGetI8$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const part = buf_Counted.tryGetI8$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetInt$Buf(a: rt.usize): rt.Result { - const part = Counted.tryGetInt$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const part = buf_Counted.tryGetInt$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntLe$Buf(a: rt.usize): rt.Result { - const part = Counted.tryGetIntLe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const part = buf_Counted.tryGetIntLe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntNe$Buf(a: rt.usize): rt.Result { - const part = Counted.tryGetIntNe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const part = buf_Counted.tryGetIntNe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetU128$Buf(): rt.Result { - return rt.bufTryGet(this.v, 16, false, rt.u128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 16, false, rt.u128FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetU128Le$Buf(): rt.Result { - return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetU128Ne$Buf(): rt.Result { - return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 16, true, rt.u128FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetU16$Buf(): rt.Result { - return rt.bufTryGet(this.v, 2, false, rt.u16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 2, false, rt.u16FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetU16Le$Buf(): rt.Result { - return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetU16Ne$Buf(): rt.Result { - return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 2, true, rt.u16FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetU32$Buf(): rt.Result { - return rt.bufTryGet(this.v, 4, false, rt.u32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 4, false, rt.u32FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetU32Le$Buf(): rt.Result { - return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetU32Ne$Buf(): rt.Result { - return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 4, true, rt.u32FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetU64$Buf(): rt.Result { - return rt.bufTryGet(this.v, 8, false, rt.u64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 8, false, rt.u64FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetU64Le$Buf(): rt.Result { - return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetU64Ne$Buf(): rt.Result { - return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, Counted.remaining$bytes_Buf, Counted.chunk$bytes_Buf, Counted.advance$bytes_Buf as (a0: Counted.Counted, a1: rt.usize) => undefined, Counted.copyToSlice$bytes_Buf as (a0: Counted.Counted, a1: rt.ByteSlice) => undefined); + return rt.bufTryGet(this.v, 8, true, rt.u64FromBeBytes, buf_Counted.remaining$bytes_Buf, buf_Counted.chunk$bytes_Buf, buf_Counted.advance$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.usize) => undefined, buf_Counted.copyToSlice$bytes_Buf as (a0: buf_Counted.Counted, a1: rt.ByteSlice) => undefined); } tryGetU8$Buf(): rt.Result { - const part = Counted.tryGetU8$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const part = buf_Counted.tryGetU8$bytes_Buf(this.v); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUint$Buf(a: rt.usize): rt.Result { - const part = Counted.tryGetUint$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const part = buf_Counted.tryGetUint$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintLe$Buf(a: rt.usize): rt.Result { - const part = Counted.tryGetUintLe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const part = buf_Counted.tryGetUintLe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintNe$Buf(a: rt.usize): rt.Result { - const part = Counted.tryGetUintNe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const part = buf_Counted.tryGetUintNe$bytes_Buf(this.v, a); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } } @@ -598,37 +598,37 @@ export class of$buf_Pieces { tryGetF32$Buf(): rt.Result { const part = Pieces.tryGetF32$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Le$Buf(): rt.Result { const part = Pieces.tryGetF32Le$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Ne$Buf(): rt.Result { const part = Pieces.tryGetF32Ne$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64$Buf(): rt.Result { const part = Pieces.tryGetF64$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Le$Buf(): rt.Result { const part = Pieces.tryGetF64Le$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Ne$Buf(): rt.Result { const part = Pieces.tryGetF64Ne$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -682,25 +682,25 @@ export class of$buf_Pieces { tryGetI8$Buf(): rt.Result { const part = Pieces.tryGetI8$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetInt$Buf(a: rt.usize): rt.Result { const part = Pieces.tryGetInt$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntLe$Buf(a: rt.usize): rt.Result { const part = Pieces.tryGetIntLe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntNe$Buf(a: rt.usize): rt.Result { const part = Pieces.tryGetIntNe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -754,25 +754,25 @@ export class of$buf_Pieces { tryGetU8$Buf(): rt.Result { const part = Pieces.tryGetU8$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUint$Buf(a: rt.usize): rt.Result { const part = Pieces.tryGetUint$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintLe$Buf(a: rt.usize): rt.Result { const part = Pieces.tryGetUintLe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintNe$Buf(a: rt.usize): rt.Result { const part = Pieces.tryGetUintNe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } } @@ -966,37 +966,37 @@ export class of$buf_Provided { tryGetF32$Buf(): rt.Result { const part = Provided.tryGetF32$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Le$Buf(): rt.Result { const part = Provided.tryGetF32Le$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Ne$Buf(): rt.Result { const part = Provided.tryGetF32Ne$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64$Buf(): rt.Result { const part = Provided.tryGetF64$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Le$Buf(): rt.Result { const part = Provided.tryGetF64Le$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Ne$Buf(): rt.Result { const part = Provided.tryGetF64Ne$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -1050,25 +1050,25 @@ export class of$buf_Provided { tryGetI8$Buf(): rt.Result { const part = Provided.tryGetI8$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetInt$Buf(a: rt.usize): rt.Result { const part = Provided.tryGetInt$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntLe$Buf(a: rt.usize): rt.Result { const part = Provided.tryGetIntLe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntNe$Buf(a: rt.usize): rt.Result { const part = Provided.tryGetIntNe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -1122,25 +1122,25 @@ export class of$buf_Provided { tryGetU8$Buf(): rt.Result { const part = Provided.tryGetU8$bytes_Buf(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUint$Buf(a: rt.usize): rt.Result { const part = Provided.tryGetUint$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintLe$Buf(a: rt.usize): rt.Result { const part = Provided.tryGetUintLe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintNe$Buf(a: rt.usize): rt.Result { const part = Provided.tryGetUintNe$bytes_Buf(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } } @@ -1334,37 +1334,37 @@ export class of$bytes_Bytes { tryGetF32$Buf(): rt.Result { const part = tryGetF32$bytes_Buf_bytes_Bytes(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Le$Buf(): rt.Result { const part = tryGetF32Le$bytes_Buf_bytes_Bytes(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Ne$Buf(): rt.Result { const part = tryGetF32Ne$bytes_Buf_bytes_Bytes(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64$Buf(): rt.Result { const part = tryGetF64$bytes_Buf_bytes_Bytes(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Le$Buf(): rt.Result { const part = tryGetF64Le$bytes_Buf_bytes_Bytes(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Ne$Buf(): rt.Result { const part = tryGetF64Ne$bytes_Buf_bytes_Bytes(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -1514,25 +1514,25 @@ export class of$bytes_Bytes { tryGetI8$Buf(): rt.Result { const part = tryGetI8$bytes_Buf_bytes_Bytes(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetInt$Buf(a: rt.usize): rt.Result { const part = tryGetInt$bytes_Buf_bytes_Bytes(this, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntLe$Buf(a: rt.usize): rt.Result { const part = tryGetIntLe$bytes_Buf_bytes_Bytes(this, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntNe$Buf(a: rt.usize): rt.Result { const part = tryGetIntNe$bytes_Buf_bytes_Bytes(this, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -1682,25 +1682,25 @@ export class of$bytes_Bytes { tryGetU8$Buf(): rt.Result { const part = tryGetU8$bytes_Buf_bytes_Bytes(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUint$Buf(a: rt.usize): rt.Result { const part = tryGetUint$bytes_Buf_bytes_Bytes(this, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintLe$Buf(a: rt.usize): rt.Result { const part = tryGetUintLe$bytes_Buf_bytes_Bytes(this, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintNe$Buf(a: rt.usize): rt.Result { const part = tryGetUintNe$bytes_Buf_bytes_Bytes(this, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } } @@ -1894,37 +1894,37 @@ export class of$bytes_BytesMut { tryGetF32$Buf(): rt.Result { const part = tryGetF32$bytes_Buf_bytes_BytesMut(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Le$Buf(): rt.Result { const part = tryGetF32Le$bytes_Buf_bytes_BytesMut(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Ne$Buf(): rt.Result { const part = tryGetF32Ne$bytes_Buf_bytes_BytesMut(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64$Buf(): rt.Result { const part = tryGetF64$bytes_Buf_bytes_BytesMut(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Le$Buf(): rt.Result { const part = tryGetF64Le$bytes_Buf_bytes_BytesMut(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Ne$Buf(): rt.Result { const part = tryGetF64Ne$bytes_Buf_bytes_BytesMut(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -2074,25 +2074,25 @@ export class of$bytes_BytesMut { tryGetI8$Buf(): rt.Result { const part = tryGetI8$bytes_Buf_bytes_BytesMut(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetInt$Buf(a: rt.usize): rt.Result { const part = tryGetInt$bytes_Buf_bytes_BytesMut(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntLe$Buf(a: rt.usize): rt.Result { const part = tryGetIntLe$bytes_Buf_bytes_BytesMut(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntNe$Buf(a: rt.usize): rt.Result { const part = tryGetIntNe$bytes_Buf_bytes_BytesMut(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -2242,25 +2242,25 @@ export class of$bytes_BytesMut { tryGetU8$Buf(): rt.Result { const part = tryGetU8$bytes_Buf_bytes_BytesMut(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUint$Buf(a: rt.usize): rt.Result { const part = tryGetUint$bytes_Buf_bytes_BytesMut(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintLe$Buf(a: rt.usize): rt.Result { const part = tryGetUintLe$bytes_Buf_bytes_BytesMut(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintNe$Buf(a: rt.usize): rt.Result { const part = tryGetUintNe$bytes_Buf_bytes_BytesMut(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } } @@ -2454,37 +2454,37 @@ export class of$bytes_buf_Take_bytes_Bytes { tryGetF32$Buf(): rt.Result { const part = Take.tryGetF32$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Le$Buf(): rt.Result { const part = Take.tryGetF32Le$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Ne$Buf(): rt.Result { const part = Take.tryGetF32Ne$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64$Buf(): rt.Result { const part = Take.tryGetF64$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Le$Buf(): rt.Result { const part = Take.tryGetF64Le$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Ne$Buf(): rt.Result { const part = Take.tryGetF64Ne$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -2538,25 +2538,25 @@ export class of$bytes_buf_Take_bytes_Bytes { tryGetI8$Buf(): rt.Result { const part = Take.tryGetI8$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetInt$Buf(a: rt.usize): rt.Result { const part = Take.tryGetInt$bytes_Buf_bytes_Bytes(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntLe$Buf(a: rt.usize): rt.Result { const part = Take.tryGetIntLe$bytes_Buf_bytes_Bytes(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntNe$Buf(a: rt.usize): rt.Result { const part = Take.tryGetIntNe$bytes_Buf_bytes_Bytes(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -2610,25 +2610,25 @@ export class of$bytes_buf_Take_bytes_Bytes { tryGetU8$Buf(): rt.Result { const part = Take.tryGetU8$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUint$Buf(a: rt.usize): rt.Result { const part = Take.tryGetUint$bytes_Buf_bytes_Bytes(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintLe$Buf(a: rt.usize): rt.Result { const part = Take.tryGetUintLe$bytes_Buf_bytes_Bytes(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintNe$Buf(a: rt.usize): rt.Result { const part = Take.tryGetUintNe$bytes_Buf_bytes_Bytes(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } } @@ -2822,37 +2822,37 @@ export class of$ref_slice_u8 { tryGetF32$Buf(): rt.Result { const part = tryGetF32$bytes_Buf_ref_slice_u8(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Le$Buf(): rt.Result { const part = tryGetF32Le$bytes_Buf_ref_slice_u8(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Ne$Buf(): rt.Result { const part = tryGetF32Ne$bytes_Buf_ref_slice_u8(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64$Buf(): rt.Result { const part = tryGetF64$bytes_Buf_ref_slice_u8(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Le$Buf(): rt.Result { const part = tryGetF64Le$bytes_Buf_ref_slice_u8(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Ne$Buf(): rt.Result { const part = tryGetF64Ne$bytes_Buf_ref_slice_u8(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -3002,25 +3002,25 @@ export class of$ref_slice_u8 { tryGetI8$Buf(): rt.Result { const part = tryGetI8$bytes_Buf_ref_slice_u8(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetInt$Buf(a: rt.usize): rt.Result { const part = tryGetInt$bytes_Buf_ref_slice_u8(this, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntLe$Buf(a: rt.usize): rt.Result { const part = tryGetIntLe$bytes_Buf_ref_slice_u8(this, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntNe$Buf(a: rt.usize): rt.Result { const part = tryGetIntNe$bytes_Buf_ref_slice_u8(this, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -3170,25 +3170,25 @@ export class of$ref_slice_u8 { tryGetU8$Buf(): rt.Result { const part = tryGetU8$bytes_Buf_ref_slice_u8(this); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUint$Buf(a: rt.usize): rt.Result { const part = tryGetUint$bytes_Buf_ref_slice_u8(this, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintLe$Buf(a: rt.usize): rt.Result { const part = tryGetUintLe$bytes_Buf_ref_slice_u8(this, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintNe$Buf(a: rt.usize): rt.Result { const part = tryGetUintNe$bytes_Buf_ref_slice_u8(this, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } } @@ -3382,37 +3382,37 @@ export class ofPlace$bytes_Bytes { tryGetF32$Buf(): rt.Result { const part = tryGetF32$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Le$Buf(): rt.Result { const part = tryGetF32Le$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Ne$Buf(): rt.Result { const part = tryGetF32Ne$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64$Buf(): rt.Result { const part = tryGetF64$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Le$Buf(): rt.Result { const part = tryGetF64Le$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Ne$Buf(): rt.Result { const part = tryGetF64Ne$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -3562,25 +3562,25 @@ export class ofPlace$bytes_Bytes { tryGetI8$Buf(): rt.Result { const part = tryGetI8$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetInt$Buf(a: rt.usize): rt.Result { const part = tryGetInt$bytes_Buf_bytes_Bytes(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntLe$Buf(a: rt.usize): rt.Result { const part = tryGetIntLe$bytes_Buf_bytes_Bytes(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntNe$Buf(a: rt.usize): rt.Result { const part = tryGetIntNe$bytes_Buf_bytes_Bytes(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -3730,25 +3730,25 @@ export class ofPlace$bytes_Bytes { tryGetU8$Buf(): rt.Result { const part = tryGetU8$bytes_Buf_bytes_Bytes(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUint$Buf(a: rt.usize): rt.Result { const part = tryGetUint$bytes_Buf_bytes_Bytes(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintLe$Buf(a: rt.usize): rt.Result { const part = tryGetUintLe$bytes_Buf_bytes_Bytes(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintNe$Buf(a: rt.usize): rt.Result { const part = tryGetUintNe$bytes_Buf_bytes_Bytes(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } } @@ -3942,37 +3942,37 @@ export class ofPlace$ref_slice_u8 { tryGetF32$Buf(): rt.Result { const part = tryGetF32$bytes_Buf_ref_slice_u8(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Le$Buf(): rt.Result { const part = tryGetF32Le$bytes_Buf_ref_slice_u8(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF32Ne$Buf(): rt.Result { const part = tryGetF32Ne$bytes_Buf_ref_slice_u8(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF32Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64$Buf(): rt.Result { const part = tryGetF64$bytes_Buf_ref_slice_u8(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Le$Buf(): rt.Result { const part = tryGetF64Le$bytes_Buf_ref_slice_u8(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetF64Ne$Buf(): rt.Result { const part = tryGetF64Ne$bytes_Buf_ref_slice_u8(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetF64Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -4122,25 +4122,25 @@ export class ofPlace$ref_slice_u8 { tryGetI8$Buf(): rt.Result { const part = tryGetI8$bytes_Buf_ref_slice_u8(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetI8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetInt$Buf(a: rt.usize): rt.Result { const part = tryGetInt$bytes_Buf_ref_slice_u8(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntLe$Buf(a: rt.usize): rt.Result { const part = tryGetIntLe$bytes_Buf_ref_slice_u8(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetIntNe$Buf(a: rt.usize): rt.Result { const part = tryGetIntNe$bytes_Buf_ref_slice_u8(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetIntOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } @@ -4290,25 +4290,25 @@ export class ofPlace$ref_slice_u8 { tryGetU8$Buf(): rt.Result { const part = tryGetU8$bytes_Buf_ref_slice_u8(this.v); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetU8Out$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUint$Buf(a: rt.usize): rt.Result { const part = tryGetUint$bytes_Buf_ref_slice_u8(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintLe$Buf(a: rt.usize): rt.Result { const part = tryGetUintLe$bytes_Buf_ref_slice_u8(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } tryGetUintNe$Buf(a: rt.usize): rt.Result { const part = tryGetUintNe$bytes_Buf_ref_slice_u8(this.v, a); - const result: rt.Result = part === undefined ? rt.Err(Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); + const result: rt.Result = part === undefined ? rt.Err(buf_Counted.tryGetUintOut$bytes_Buf.err as TryGetError.TryGetError) : rt.Ok(part); return result; } } diff --git a/ts/fixtures/stock/expected/bytes/buf/buf_impl.ts b/ts/fixtures/stock/expected/bytes/buf/buf_impl.ts index 2f57bb4bd..b32a0c7bb 100644 --- a/ts/fixtures/stock/expected/bytes/buf/buf_impl.ts +++ b/ts/fixtures/stock/expected/bytes/buf/buf_impl.ts @@ -1,7 +1,7 @@ // Generated by rust2-ts. Do not edit. import * as rt from "../../rt.ts"; -import * as Counted from "../../buf.Counted.ts"; +import * as buf_Counted from "../../buf.Counted.ts"; import type * as Leased from "../../buf.Leased.ts"; import * as Pieces from "../../buf.Pieces.ts"; import { panicDoesNotFit } from "../../bytes.ts"; @@ -189,7 +189,7 @@ export function tryGetU8$bytes_Buf_bytes_Bytes(self: rt.Place): rt rt.bytesAdvance(self, 1); return ret; } - Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_Bytes(self) }; + buf_Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_Bytes(self) }; return undefined; } @@ -226,7 +226,7 @@ export function tryGetU8$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.u8 | un rt.bytesMutAdvance(self, 1); return ret; } - Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_BytesMut(self) }; + buf_Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_BytesMut(self) }; return undefined; } @@ -263,7 +263,7 @@ export function tryGetU8$bytes_Buf_ref_slice_u8(self: rt.Place): r rt.byteSliceAdvance(self, 1); return ret; } - Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_ref_slice_u8(self) }; + buf_Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_ref_slice_u8(self) }; return undefined; } @@ -300,7 +300,7 @@ export function tryGetI8$bytes_Buf_bytes_Bytes(self: rt.Place): rt rt.bytesAdvance(self, 1); return ret; } - Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_Bytes(self) }; + buf_Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_Bytes(self) }; return undefined; } @@ -337,7 +337,7 @@ export function tryGetI8$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.i8 | un rt.bytesMutAdvance(self, 1); return ret; } - Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_BytesMut(self) }; + buf_Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_BytesMut(self) }; return undefined; } @@ -374,7 +374,7 @@ export function tryGetI8$bytes_Buf_ref_slice_u8(self: rt.Place): r rt.byteSliceAdvance(self, 1); return ret; } - Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_ref_slice_u8(self) }; + buf_Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_ref_slice_u8(self) }; return undefined; } @@ -419,7 +419,7 @@ export function tryGetUint$bytes_Buf_bytes_Bytes(self: rt.Place, n if (_8.ok) { return rt.u64FromBeBytes(buf); } - Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -465,7 +465,7 @@ export function tryGetUint$bytes_Buf_bytes_BytesMut(self: rt.BytesMut, nbytes: r if (_8.ok) { return rt.u64FromBeBytes(buf); } - Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -511,7 +511,7 @@ export function tryGetUint$bytes_Buf_ref_slice_u8(self: rt.Place, if (_8.ok) { return rt.u64FromBeBytes(buf); } - Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -556,7 +556,7 @@ export function tryGetUintLe$bytes_Buf_bytes_Bytes(self: rt.Place, if (_11.ok) { return rt.u64FromBeBytes(buf.slice().reverse()); } - Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -601,7 +601,7 @@ export function tryGetUintLe$bytes_Buf_bytes_BytesMut(self: rt.BytesMut, nbytes: if (_11.ok) { return rt.u64FromBeBytes(buf.slice().reverse()); } - Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -646,7 +646,7 @@ export function tryGetUintLe$bytes_Buf_ref_slice_u8(self: rt.Place if (_11.ok) { return rt.u64FromBeBytes(buf.slice().reverse()); } - Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -812,7 +812,7 @@ export function tryGetInt$bytes_Buf_bytes_Bytes(self: rt.Place, nb if (_8.ok) { return rt.i64FromBeBytes(buf); } - Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -858,7 +858,7 @@ export function tryGetInt$bytes_Buf_bytes_BytesMut(self: rt.BytesMut, nbytes: rt if (_8.ok) { return rt.i64FromBeBytes(buf); } - Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -904,7 +904,7 @@ export function tryGetInt$bytes_Buf_ref_slice_u8(self: rt.Place, n if (_8.ok) { return rt.i64FromBeBytes(buf); } - Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -949,7 +949,7 @@ export function tryGetIntLe$bytes_Buf_bytes_Bytes(self: rt.Place, if (_11.ok) { return rt.i64FromBeBytes(buf.slice().reverse()); } - Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -994,7 +994,7 @@ export function tryGetIntLe$bytes_Buf_bytes_BytesMut(self: rt.BytesMut, nbytes: if (_11.ok) { return rt.i64FromBeBytes(buf.slice().reverse()); } - Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -1039,7 +1039,7 @@ export function tryGetIntLe$bytes_Buf_ref_slice_u8(self: rt.Place, if (_11.ok) { return rt.i64FromBeBytes(buf.slice().reverse()); } - Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -1204,7 +1204,7 @@ export function tryGetF32$bytes_Buf_bytes_Bytes(self: rt.Place): r if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1248,7 +1248,7 @@ export function tryGetF32$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.f32 | if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1292,7 +1292,7 @@ export function tryGetF32$bytes_Buf_ref_slice_u8(self: rt.Place): if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1336,7 +1336,7 @@ export function tryGetF32Le$bytes_Buf_bytes_Bytes(self: rt.Place): if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1380,7 +1380,7 @@ export function tryGetF32Le$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.f32 if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1424,7 +1424,7 @@ export function tryGetF32Le$bytes_Buf_ref_slice_u8(self: rt.Place) if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1471,7 +1471,7 @@ export function tryGetF32Ne$bytes_Buf_bytes_Bytes(self: rt.Place): if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1518,7 +1518,7 @@ export function tryGetF32Ne$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.f32 if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1565,7 +1565,7 @@ export function tryGetF32Ne$bytes_Buf_ref_slice_u8(self: rt.Place) if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1609,7 +1609,7 @@ export function tryGetF64$bytes_Buf_bytes_Bytes(self: rt.Place): r if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1653,7 +1653,7 @@ export function tryGetF64$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.f64 | if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1697,7 +1697,7 @@ export function tryGetF64$bytes_Buf_ref_slice_u8(self: rt.Place): if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1741,7 +1741,7 @@ export function tryGetF64Le$bytes_Buf_bytes_Bytes(self: rt.Place): if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1785,7 +1785,7 @@ export function tryGetF64Le$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.f64 if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1829,7 +1829,7 @@ export function tryGetF64Le$bytes_Buf_ref_slice_u8(self: rt.Place) if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1876,7 +1876,7 @@ export function tryGetF64Ne$bytes_Buf_bytes_Bytes(self: rt.Place): if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1923,7 +1923,7 @@ export function tryGetF64Ne$bytes_Buf_bytes_BytesMut(self: rt.BytesMut): rt.f64 if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1970,7 +1970,7 @@ export function tryGetF64Ne$bytes_Buf_ref_slice_u8(self: rt.Place) if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -3826,7 +3826,7 @@ export function tryGetI64Le$bytes_Buf_mut_bytes_Bytes(self: rt.Place): rt.i64 | undefined { const _0: rt.Result = self.v.tryGetI64Le$Buf(); if (!_0.ok) { - Counted.tryGetIntOut$bytes_Buf.err = _0.error; + buf_Counted.tryGetIntOut$bytes_Buf.err = _0.error; return undefined; } return _0.value; @@ -3904,7 +3904,7 @@ export function tryGetI64Le$bytes_Buf_mut_ref_slice_u8(self: rt.Place): rt.u8 | undefined { const _0: rt.Result = self.v.tryGetU8$Buf(); if (!_0.ok) { - Counted.tryGetU8Out$bytes_Buf.err = _0.error; + buf_Counted.tryGetU8Out$bytes_Buf.err = _0.error; return undefined; } return _0.value; @@ -4727,7 +4727,7 @@ export function remaining$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: Buf.Buf): rt.u export function tryGetI64Le$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.i64 | undefined { const _0: rt.Result = self.v.tryGetI64Le$Buf(); if (!_0.ok) { - Counted.tryGetIntOut$bytes_Buf.err = _0.error; + buf_Counted.tryGetIntOut$bytes_Buf.err = _0.error; return undefined; } return _0.value; @@ -4831,7 +4831,7 @@ export function tryGetU16$bytes_Buf_boxed_Box_dyn_bytes_Buf(self: rt.Place): rt.u8 | undefined { const _0: rt.Result = self.v.tryGetU8$Buf(); if (!_0.ok) { - Counted.tryGetU8Out$bytes_Buf.err = _0.error; + buf_Counted.tryGetU8Out$bytes_Buf.err = _0.error; return undefined; } return _0.value; diff --git a/ts/fixtures/stock/expected/bytes/buf/take.Take.ts b/ts/fixtures/stock/expected/bytes/buf/take.Take.ts index d5dcd40ad..ac07da30d 100644 --- a/ts/fixtures/stock/expected/bytes/buf/take.Take.ts +++ b/ts/fixtures/stock/expected/bytes/buf/take.Take.ts @@ -1,7 +1,7 @@ // Generated by rust2-ts. Do not edit. import * as rt from "../../rt.ts"; -import * as Counted from "../../buf.Counted.ts"; +import * as buf_Counted from "../../buf.Counted.ts"; import { panicAdvance, panicDoesNotFit } from "../../bytes.ts"; import { signExtend } from "../../bytes/buf/buf_impl.ts"; import type * as TryGetError from "../../bytes.TryGetError.ts"; @@ -514,7 +514,7 @@ export function tryGetU8$bytes_Buf_bytes_Bytes(self: Take): rt.u8 advance$bytes_Buf_bytes_Bytes(self, 1); return ret; } - Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_Bytes(self) }; + buf_Counted.tryGetU8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_Bytes(self) }; return undefined; } @@ -551,7 +551,7 @@ export function tryGetI8$bytes_Buf_bytes_Bytes(self: Take): rt.i8 advance$bytes_Buf_bytes_Bytes(self, 1); return ret; } - Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_Bytes(self) }; + buf_Counted.tryGetI8Out$bytes_Buf.err = { requested: 1, available: remaining$bytes_Buf_mut_bytes_Bytes(self) }; return undefined; } @@ -596,7 +596,7 @@ export function tryGetUint$bytes_Buf_bytes_Bytes(self: Take, nbyte if (_8.ok) { return rt.u64FromBeBytes(buf); } - Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetUintOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -641,7 +641,7 @@ export function tryGetUintLe$bytes_Buf_bytes_Bytes(self: Take, nby if (_11.ok) { return rt.u64FromBeBytes(buf.slice().reverse()); } - Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetUintOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -727,7 +727,7 @@ export function tryGetInt$bytes_Buf_bytes_Bytes(self: Take, nbytes if (_8.ok) { return rt.i64FromBeBytes(buf); } - Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetIntOut$bytes_Buf.err = (_8 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -772,7 +772,7 @@ export function tryGetIntLe$bytes_Buf_bytes_Bytes(self: Take, nbyt if (_11.ok) { return rt.i64FromBeBytes(buf.slice().reverse()); } - Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetIntOut$bytes_Buf.err = (_11 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } } @@ -849,7 +849,7 @@ export function tryGetF32$bytes_Buf_bytes_Bytes(self: Take): rt.f3 if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -885,7 +885,7 @@ export function tryGetF32Le$bytes_Buf_bytes_Bytes(self: Take): rt. if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -924,7 +924,7 @@ export function tryGetF32Ne$bytes_Buf_bytes_Bytes(self: Take): rt. if (_3.ok) { return rt.f32FromBits(_3.value); } - Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF32Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -960,7 +960,7 @@ export function tryGetF64$bytes_Buf_bytes_Bytes(self: Take): rt.f6 if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -996,7 +996,7 @@ export function tryGetF64Le$bytes_Buf_bytes_Bytes(self: Take): rt. if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } @@ -1035,7 +1035,7 @@ export function tryGetF64Ne$bytes_Buf_bytes_Bytes(self: Take): rt. if (_3.ok) { return rt.f64FromBits(_3.value); } - Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; + buf_Counted.tryGetF64Out$bytes_Buf.err = (_3 as { ok: false; error: TryGetError.TryGetError }).error; return undefined; } diff --git a/ts/fixtures/stock/expected/maps.ts b/ts/fixtures/stock/expected/maps.ts index 6f923ab1d..7c14b809f 100644 --- a/ts/fixtures/stock/expected/maps.ts +++ b/ts/fixtures/stock/expected/maps.ts @@ -5,7 +5,7 @@ import { copy$tuple2_u16_u32, drop$hashlink_LinkedHashMap_sync_Arc_str_u32 as li import { unwrapOr$0r2bmpr as option_unwrapOr$0r2bmpr, mapOr$1787w44 as option_mapOr$1787w44, mapOr$0iaogpf as option_mapOr$0iaogpf, mapOr$1vcgixw as option_mapOr$1vcgixw } from "./core/option.ts"; import * as LinkedHashMap from "./hashlink/linked_hash_map.LinkedHashMap.ts"; import type * as DefaultHashBuilder from "./hashlink.DefaultHashBuilder.ts"; -import * as Counted from "./maps.Counted.ts"; +import * as maps_Counted from "./maps.Counted.ts"; /** A length, capacity, or value, as four bytes. */ export function put(out: rt.ByteVec, n: rt.usize): void { @@ -209,7 +209,7 @@ export function table(dataData: Uint8Array, dataStart: number, dataLen: number, } else if (_38 === 6) { if (!((arg & 16) === 0)) { const drops: rt.Cell = new rt.Cell(0); - const captured = new Counted.Counted(drops); + const captured = new maps_Counted.Counted(drops); const captured2 = key; const made: () => [rt.u16, rt.u32] = rt.closure((): [rt.u16, rt.u32] => { return [captured2, rt.u32Add(3, captured._0.v)] as [rt.u16, rt.u32]; @@ -283,7 +283,7 @@ export function numbers(n: rt.HashTable, kind: rt.u8, op: rt.u8, key: rt const _12: rt.u8 = rt.u8Rem(op, 6); if (_12 === 0) { const drops: rt.Cell = new rt.Cell(0); - const held: Counted.Counted = new Counted.Counted(drops); + const held: maps_Counted.Counted = new maps_Counted.Counted(drops); const _18: rt.TableEntry = rt.tableEntry(n, h, ours, rehash); const captured = held; const e: rt.TableEntry = rt.tableAndModifyMut(_18, rt.closure((e8: rt.Place): undefined => {