< Summary

Information
Class: SwiftCollections.SwiftArrayState<T>
Assembly: SwiftCollections
File(s): /home/runner/work/SwiftCollections/SwiftCollections/src/SwiftCollections/Serialization/State/SwiftArrayState.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 43
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/SwiftArrayState.cs

#LineLine coverage
 1//=======================================================================
 2// SwiftArrayState.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024–present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using MemoryPack;
 9using System;
 10using System.Text.Json.Serialization;
 11
 12namespace SwiftCollections;
 13
 14/// <summary>
 15/// Represents an immutable snapshot of an array of items of the specified type.
 16/// </summary>
 17/// <remarks>
 18/// This struct is intended for scenarios where a value-type representation of an array is needed, such as serialization
 19/// The array referenced by the Items field should not be modified after construction to preserve immutability.
 20/// </remarks>
 21/// <typeparam name="T">The type of elements contained in the array.</typeparam>
 22[Serializable]
 23[MemoryPackable]
 24public readonly partial struct SwiftArrayState<T>
 25{
 26    /// <summary>
 27    /// Gets the array of items contained in the collection.
 28    /// </summary>
 29    [JsonInclude]
 30    [MemoryPackInclude]
 31    public readonly T[] Items;
 32
 33    /// <summary>
 34    /// Initializes a new instance of the SwiftArrayState class with the specified items.
 35    /// </summary>
 36    /// <param name="items">The array of items to initialize the state with. Cannot be null.</param>
 37    [JsonConstructor]
 38    [MemoryPackConstructor]
 39    public SwiftArrayState(T[] items)
 40    {
 8941        Items = items;
 8942    }
 43}

Methods/Properties

.ctor(T[])