Class QueueSerializer<T>
Type serializer for Queue<T> collections. Serializes the queue as a JSON
array token sequence in FIFO (front-to-back) order, or as a null token when the queue
reference itself is null. On deserialization, elements are enqueued in the order
they appear in the array, preserving FIFO semantics.
Inherited Members
Namespace: Scylla.Core.Util.Serialization
Assembly: ScyllaCore.dll
Syntax
public sealed class QueueSerializer<T> : TypeSerializerBase<Queue<T>>, ITypeSerializer<Queue<T>>, ITypeSerializer
Type Parameters
| Name | Description |
|---|---|
| T | The element type of the queue. Element serialization is handled either by the explicitly supplied ITypeSerializer or by dynamic dispatch through SerializationEngine. |
Remarks
Comma handling between JSON elements is delegated to SkipComma() when the active reader is a ScyllaJSONReader.
Constructors
QueueSerializer(ITypeSerializer)
Creates a Queue serializer that uses the specified serializer for each element.
Declaration
public QueueSerializer(ITypeSerializer elementSerializer)
Parameters
| Type | Name | Description |
|---|---|---|
| ITypeSerializer | elementSerializer | The non-generic serializer to use for every queue element, or |
Methods
Read(IScyllaReader, ISerializationContext)
Reads a Queue<T> from the reader.
Returns null when the next token is a null literal; otherwise reads all elements
from the array token sequence, enqueuing them in order, and returns the resulting queue.
Declaration
public override Queue<T> Read(IScyllaReader reader, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| IScyllaReader | reader | The reader positioned at the start of an array token sequence or a null token.
Never |
| ISerializationContext | context | The active serialization context. Never |
Returns
| Type | Description |
|---|---|
| Queue<T> | The deserialized queue with elements in FIFO order, or |
Overrides
Write(Queue<T>, IScyllaWriter, ISerializationContext)
Writes a Queue<T> to the output in FIFO order.
Emits a null token if value is null; otherwise emits a
JSON array containing all elements serialized from front to back.
Declaration
public override void Write(Queue<T> value, IScyllaWriter writer, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| Queue<T> | value | The queue to serialize, or |
| IScyllaWriter | writer | The writer that receives the serialized output. Never |
| ISerializationContext | context | The active serialization context. Never |