@hazae41/binary
Advanced tools
Comparing version 1.2.24 to 1.2.25
@@ -5,4 +5,3 @@ import * as index from './mods/index.js'; | ||
export { Opaque, SafeOpaque, UnsafeOpaque } from './mods/binary/opaque.js'; | ||
export { Preparable, UnpreparedError } from './mods/binary/preparable.js'; | ||
export { BinaryReadUnderflowError, Readable } from './mods/binary/readable.js'; | ||
export { BinaryWriteUnderflowError, Writable } from './mods/binary/writable.js'; |
@@ -28,3 +28,3 @@ import { Bytes, Sized } from '@hazae41/bytes'; | ||
*/ | ||
tryInto<ReadOutput, ReadError>(readable: Readable<ReadOutput, ReadError>): Result<ReadOutput, ReadError | BinaryReadUnderflowError>; | ||
tryInto<T extends Readable>(readable: T): Result<Readable.ReadOutput<T>, Readable.ReadError<T> | BinaryReadUnderflowError>; | ||
/** | ||
@@ -35,3 +35,3 @@ * Create an opaque from a binary data type | ||
*/ | ||
static tryFrom<SizeError, WriteError>(writable: Writable<SizeError, WriteError>): Result<Opaque, SizeError | WriteError | BinaryWriteUnderflowError>; | ||
static tryFrom<T extends Writable>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | BinaryWriteUnderflowError>; | ||
} | ||
@@ -38,0 +38,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
import { Bytes } from '@hazae41/bytes'; | ||
import { Cursor } from '@hazae41/cursor'; | ||
@@ -14,6 +15,6 @@ import { Result } from '@hazae41/result'; | ||
/** | ||
* Read bytes from a cursor | ||
* Read from a cursor | ||
* @param cursor | ||
*/ | ||
tryRead(cursor: Cursor): Result<ReadOutput, ReadError>; | ||
tryRead(cursor: Cursor): Result<Readable.ReadOutput<this>, Readable.ReadError<this>>; | ||
} | ||
@@ -31,5 +32,7 @@ declare namespace Readable { | ||
*/ | ||
function tryReadOrRollback<ReadOutput, ReadError>(readable: Readable<ReadOutput, ReadError>, cursor: Cursor): Result<ReadOutput, ReadError>; | ||
function tryReadOrRollback<T extends Readable>(readable: T, cursor: Cursor): Result<ReadOutput<T>, ReadError<T>>; | ||
/** | ||
* Read a binary data type from bytes | ||
* Read from bytes and check for underflow | ||
* | ||
* Underflow is when the cursor has remaining bytes; meaning we read less bytes than the expected length | ||
* @param readable | ||
@@ -39,5 +42,5 @@ * @param bytes | ||
*/ | ||
function tryReadFromBytes<ReadOutput, ReadError>(readable: Readable<ReadOutput, ReadError>, bytes: Uint8Array): Result<ReadOutput, ReadError | BinaryReadUnderflowError>; | ||
function tryReadFromBytes<T extends Readable>(readable: T, bytes: Bytes): Result<ReadOutput<T>, ReadError<T> | BinaryReadUnderflowError>; | ||
} | ||
export { BinaryReadUnderflowError, Readable }; |
@@ -14,10 +14,10 @@ import { Cursor } from '@hazae41/cursor'; | ||
/** | ||
* Get the amount of bytes | ||
* Compute the amount of bytes to allocate | ||
*/ | ||
trySize(): Result<number, SizeError>; | ||
trySize(): Result<number, Writable.SizeError<this>>; | ||
/** | ||
* Write bytes to a cursor | ||
* Write to a cursor | ||
* @param cursor | ||
*/ | ||
tryWrite(cursor: Cursor): Result<void, WriteError>; | ||
tryWrite(cursor: Cursor): Result<void, Writable.WriteError<this>>; | ||
} | ||
@@ -28,9 +28,11 @@ declare namespace Writable { | ||
/** | ||
* Write a binary data type to bytes | ||
* Write to bytes and check for underflow | ||
* | ||
* Underflow is when the cursor has remaining bytes; meaning we have written less bytes than allocated | ||
* @param writable | ||
* @returns | ||
*/ | ||
function tryWriteToBytes<SizeError, WriteError>(writable: Writable<SizeError, WriteError>): Err<SizeError> | Err<WriteError> | Err<BinaryWriteUnderflowError> | Ok<Uint8Array>; | ||
function tryWriteToBytes<T extends Writable>(writable: T): Err<SizeError<T>> | Err<WriteError<T>> | Err<BinaryWriteUnderflowError> | Ok<Uint8Array>; | ||
} | ||
export { BinaryWriteUnderflowError, Writable }; |
export { Empty } from './binary/empty.js'; | ||
export { Opaque, SafeOpaque, UnsafeOpaque } from './binary/opaque.js'; | ||
export { Preparable, UnpreparedError } from './binary/preparable.js'; | ||
export { BinaryReadUnderflowError, Readable } from './binary/readable.js'; | ||
export { BinaryWriteUnderflowError, Writable } from './binary/writable.js'; |
{ | ||
"type": "module", | ||
"name": "@hazae41/binary", | ||
"version": "1.2.24", | ||
"version": "1.2.25", | ||
"description": "Zero-copy binary data types", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/hazae41/binary", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45777
32
583