< Summary

Information
Class: Trailblazer.Pathing.NavigationSeamEditToken
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Graph/NavigationSeamEditToken.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 35
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%
Create()100%11100%
FromIncrementedValue(...)100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Graph/NavigationSeamEditToken.cs

#LineLine coverage
 1//=======================================================================
 2// NavigationSeamEditToken.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 System;
 9using System.Threading;
 10
 11namespace Trailblazer.Pathing;
 12
 13/// <summary>Provides process-unique nonwrapping ownership for seam edit sessions.</summary>
 14internal readonly struct NavigationSeamEditToken
 15{
 16    private static long _highWater;
 17
 328418    private NavigationSeamEditToken(long value) => Value = value;
 19
 20    internal long Value { get; }
 21
 22    internal static NavigationSeamEditToken Create()
 23    {
 328324        long value = Interlocked.Increment(ref _highWater);
 328325        return FromIncrementedValue(value);
 26    }
 27
 28    internal static NavigationSeamEditToken FromIncrementedValue(long value)
 29    {
 328530        SwiftThrowHelper.ThrowIfTrue(
 328531            value <= 0,
 328532            message: "The seam edit ownership token space was exhausted.");
 328433        return new NavigationSeamEditToken(value);
 34    }
 35}