@hazae41/binary
Advanced tools
Comparing version 1.2.29 to 1.2.30
@@ -8,2 +8,3 @@ import { CursorReadError, Cursor, CursorWriteError } from '@hazae41/cursor'; | ||
readonly cursor: Cursor; | ||
readonly name: string; | ||
constructor(cursor: Cursor); | ||
@@ -15,2 +16,3 @@ } | ||
readonly cursor: Cursor; | ||
readonly name: string; | ||
constructor(cursor: Cursor); | ||
@@ -17,0 +19,0 @@ } |
@@ -29,3 +29,3 @@ import { Bytes, Sized } from '@hazae41/bytes'; | ||
*/ | ||
tryInto<T extends Readable>(readable: T): Result<Readable.ReadOutput<T>, Readable.ReadError<T> | CursorReadLengthUnderflowError>; | ||
tryInto<T extends Readable.Infer<T>>(readable: T): Result<Readable.ReadOutput<T>, Readable.ReadError<T> | CursorReadLengthUnderflowError>; | ||
/** | ||
@@ -36,3 +36,3 @@ * Create an opaque from a binary data type | ||
*/ | ||
static tryFrom<T extends Writable>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | CursorWriteLenghtUnderflowError>; | ||
static tryFrom<T extends Writable.Infer<T>>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | CursorWriteLenghtUnderflowError>; | ||
} | ||
@@ -54,3 +54,3 @@ /** | ||
*/ | ||
function tryFrom<T extends Writable>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | CursorWriteLenghtUnderflowError>; | ||
function tryFrom<T extends Writable.Infer<T>>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | CursorWriteLenghtUnderflowError>; | ||
} | ||
@@ -72,5 +72,5 @@ /** | ||
*/ | ||
function tryFrom<T extends Writable>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | CursorWriteLenghtUnderflowError>; | ||
function tryFrom<T extends Writable.Infer<T>>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | CursorWriteLenghtUnderflowError>; | ||
} | ||
export { Opaque, SafeOpaque, UnsafeOpaque }; |
@@ -14,7 +14,9 @@ import { Bytes } from '@hazae41/bytes'; | ||
*/ | ||
tryRead(cursor: Cursor): Result<Readable.ReadOutput<this>, Readable.ReadError<this>>; | ||
tryRead(cursor: Cursor): Result<ReadOutput, ReadError>; | ||
} | ||
declare namespace Readable { | ||
type Infer<T extends Readable> = Readable<Readable.ReadOutput<T>, Readable.ReadError<T>>; | ||
type ReadOutput<T extends Readable> = T extends Readable<infer ReadOutput, unknown> ? ReadOutput : never; | ||
type ReadError<T extends Readable> = T extends Readable<unknown, infer ReadError> ? ReadError : never; | ||
function tryRead<T extends Readable>(readable: Infer<T>, cursor: Cursor): Result<ReadOutput<T>, ReadError<T>>; | ||
/** | ||
@@ -28,3 +30,3 @@ * Try to read a binary data type from a cursor | ||
*/ | ||
function tryReadOrRollback<T extends Readable>(readable: T, cursor: Cursor): Result<ReadOutput<T>, ReadError<T>>; | ||
function tryReadOrRollback<T extends Infer<T>>(readable: T, cursor: Cursor): Result<ReadOutput<T>, ReadError<T>>; | ||
/** | ||
@@ -38,5 +40,5 @@ * Read from bytes and check for underflow | ||
*/ | ||
function tryReadFromBytes<T extends Readable>(readable: T, bytes: Bytes): Result<ReadOutput<T>, ReadError<T> | CursorReadLengthUnderflowError>; | ||
function tryReadFromBytes<T extends Infer<T>>(readable: T, bytes: Bytes): Result<ReadOutput<T>, ReadError<T> | CursorReadLengthUnderflowError>; | ||
} | ||
export { Readable }; |
@@ -13,3 +13,3 @@ import { Bytes } from '@hazae41/bytes'; | ||
*/ | ||
trySize(): Result<number, Writable.SizeError<this>>; | ||
trySize(): Result<number, SizeError>; | ||
/** | ||
@@ -19,5 +19,6 @@ * Write to a cursor | ||
*/ | ||
tryWrite(cursor: Cursor): Result<void, Writable.WriteError<this>>; | ||
tryWrite(cursor: Cursor): Result<void, WriteError>; | ||
} | ||
declare namespace Writable { | ||
type Infer<T extends Writable> = Writable<SizeError<T>, WriteError<T>>; | ||
type SizeError<T extends Writable> = T extends Writable<infer SizeError, unknown> ? SizeError : never; | ||
@@ -32,5 +33,5 @@ type WriteError<T extends Writable> = T extends Writable<unknown, infer WriteError> ? WriteError : never; | ||
*/ | ||
function tryWriteToBytes<T extends Writable>(writable: T): Result<Bytes, SizeError<T> | WriteError<T> | CursorWriteLenghtUnderflowError>; | ||
function tryWriteToBytes<T extends Writable>(writable: Infer<T>): Result<Bytes, SizeError<T> | WriteError<T> | CursorWriteLenghtUnderflowError>; | ||
} | ||
export { Writable }; |
{ | ||
"type": "module", | ||
"name": "@hazae41/binary", | ||
"version": "1.2.29", | ||
"version": "1.2.30", | ||
"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
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
56059
694