< Summary

Information
Class: SwiftCollections.SwiftDictionaryState<T1, T2>
Assembly: SwiftCollections
File(s): /home/runner/work/SwiftCollections/SwiftCollections/src/SwiftCollections/Serialization/State/SwiftDictionaryState.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 41
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%

File(s)

/home/runner/work/SwiftCollections/SwiftCollections/src/SwiftCollections/Serialization/State/SwiftDictionaryState.cs

#LineLine coverage
 1using MemoryPack;
 2using System;
 3using System.Collections.Generic;
 4using System.Text.Json.Serialization;
 5
 6namespace SwiftCollections;
 7
 8/// <summary>
 9/// Represents an immutable snapshot of the key-value pairs contained in a dictionary at a specific point in time.
 10/// </summary>
 11/// <remarks>
 12/// This struct is typically used to serialize or transfer the state of a dictionary.
 13/// The contents are read-only and reflect the state of the dictionary when the snapshot was taken.
 14/// </remarks>
 15/// <typeparam name="TKey">The type of keys in the dictionary.</typeparam>
 16/// <typeparam name="TValue">The type of values in the dictionary.</typeparam>
 17[Serializable]
 18[MemoryPackable]
 19public readonly partial struct SwiftDictionaryState<TKey, TValue>
 20{
 21    /// <summary>
 22    /// Gets the collection of key/value pairs contained in the object.
 23    /// </summary>
 24    [JsonInclude]
 25    [MemoryPackInclude]
 26    public readonly KeyValuePair<TKey, TValue>[] Items;
 27
 28    /// <summary>
 29    /// Initializes a new instance of the SwiftDictionaryState class with the specified key-value pairs.
 30    /// </summary>
 31    /// <remarks>
 32    /// This constructor is typically used during deserialization to restore the state of the dictionary from a serializ
 33    /// </remarks>
 34    /// <param name="items">An array of key-value pairs to initialize the dictionary state. Cannot be null.</param>
 35    [JsonConstructor]
 36    [MemoryPackConstructor]
 37    public SwiftDictionaryState(KeyValuePair<TKey, TValue>[] items)
 38    {
 3139        Items = items;
 3140    }
 41}