getBooleanCodec
Call Signature
Returns a codec for encoding and decoding boolean values.
By default, booleans are stored as a u8 (1 for true, 0 for false).
The size option allows customizing the number codec used for storage.
Returns
FixedSizeCodec<boolean, boolean, 1>
A FixedSizeCodec<boolean, boolean, N> where N is the size of the number codec.
Examples
Encoding and decoding booleans using a u8 (default).
Encoding and decoding booleans using a custom number codec.
Remarks
Separate getBooleanEncoder and getBooleanDecoder functions are available.
See
Call Signature
Returns a codec for encoding and decoding boolean values.
By default, booleans are stored as a u8 (1 for true, 0 for false).
The size option allows customizing the number codec used for storage.
Type Parameters
| Type Parameter |
|---|
TSize extends number |
Parameters
| Parameter | Type | Description |
|---|---|---|
config | BooleanCodecConfig<NumberCodec> & object | Configuration options for encoding and decoding booleans. |
Returns
FixedSizeCodec<boolean, boolean, TSize>
A FixedSizeCodec<boolean, boolean, N> where N is the size of the number codec.
Examples
Encoding and decoding booleans using a u8 (default).
Encoding and decoding booleans using a custom number codec.
Remarks
Separate getBooleanEncoder and getBooleanDecoder functions are available.
See
Call Signature
Returns a codec for encoding and decoding boolean values.
By default, booleans are stored as a u8 (1 for true, 0 for false).
The size option allows customizing the number codec used for storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
config | BooleanCodecConfig<NumberCodec> | Configuration options for encoding and decoding booleans. |
Returns
VariableSizeCodec<boolean>
A FixedSizeCodec<boolean, boolean, N> where N is the size of the number codec.
Examples
Encoding and decoding booleans using a u8 (default).
Encoding and decoding booleans using a custom number codec.
Remarks
Separate getBooleanEncoder and getBooleanDecoder functions are available.