getSetEncoder
Call Signature
Returns an encoder for sets of items.
This encoder serializes Set<T> values by encoding each item using the provided item encoder.
The number of items is stored as a prefix using a u32 codec by default.
For more details, see getSetCodec.
Type Parameters
| Type Parameter | Description |
|---|---|
TFrom | The type of the items in the set before encoding. |
Parameters
| Parameter | Type | Description |
|---|---|---|
item | Encoder<TFrom> | The encoder to use for each set item. |
config | SetCodecConfig<NumberEncoder> & object | Optional configuration specifying the size strategy. |
Returns
FixedSizeEncoder<Set<TFrom>, 0>
An Encoder<Set<TFrom>> for encoding sets of items.
Example
Encoding a set of u8 numbers.
See
Call Signature
Returns an encoder for sets of items.
This encoder serializes Set<T> values by encoding each item using the provided item encoder.
The number of items is stored as a prefix using a u32 codec by default.
For more details, see getSetCodec.
Type Parameters
| Type Parameter | Description |
|---|---|
TFrom | The type of the items in the set before encoding. |
Parameters
| Parameter | Type | Description |
|---|---|---|
item | FixedSizeEncoder<TFrom> | The encoder to use for each set item. |
config | SetCodecConfig<NumberEncoder> & object | Optional configuration specifying the size strategy. |
Returns
FixedSizeEncoder<Set<TFrom>>
An Encoder<Set<TFrom>> for encoding sets of items.
Example
Encoding a set of u8 numbers.
See
Call Signature
Returns an encoder for sets of items.
This encoder serializes Set<T> values by encoding each item using the provided item encoder.
The number of items is stored as a prefix using a u32 codec by default.
For more details, see getSetCodec.
Type Parameters
| Type Parameter | Description |
|---|---|
TFrom | The type of the items in the set before encoding. |
Parameters
| Parameter | Type | Description |
|---|---|---|
item | Encoder<TFrom> | The encoder to use for each set item. |
config? | SetCodecConfig<NumberEncoder> | Optional configuration specifying the size strategy. |
Returns
VariableSizeEncoder<Set<TFrom>>
An Encoder<Set<TFrom>> for encoding sets of items.
Example
Encoding a set of u8 numbers.