getBooleanCodec
Call Signature
getBooleanCodec():
FixedSizeCodec
<boolean
,boolean
,1
>
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
getBooleanCodec<
TSize
>(config
):FixedSizeCodec
<boolean
,boolean
,TSize
>
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
getBooleanCodec(
config
):VariableSizeCodec
<boolean
>
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.