< Summary

Information
Class: IceRpc.Ice.Codec.ReadOnlySequenceExtensions
Assembly: IceRpc
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/Ice/Codec/ReadOnlySequenceExtensions.cs
Tag: 1321_24790053727
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 24
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 1
Fully covered methods: 1
Total methods: 1
Method coverage: 100%
Full method coverage: 100%

Metrics

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

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/Ice/Codec/ReadOnlySequenceExtensions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using System.Buffers;
 4
 5namespace IceRpc.Ice.Codec;
 6
 7/// <summary>Extension methods for <see cref="ReadOnlySequence{T}" />.</summary>
 8public static class ReadOnlySequenceExtensions
 9{
 10    /// <summary>Decodes an Ice buffer.</summary>
 11    /// <typeparam name="T">The decoded type.</typeparam>
 12    /// <param name="buffer">The byte buffer.</param>
 13    /// <param name="decodeFunc">The decode function for buffer.</param>
 14    /// <returns>The decoded value.</returns>
 15    /// <exception cref="InvalidDataException">Thrown when <paramref name="decodeFunc" /> finds invalid data
 16    /// or when the buffer is not fully consumed and contains trailing bytes after decoding.</exception>
 17    public static T DecodeIceBuffer<T>(this ReadOnlySequence<byte> buffer, DecodeFunc<T> decodeFunc)
 451018    {
 451019        var decoder = new IceDecoder(buffer);
 451020        T result = decodeFunc(ref decoder);
 451021        decoder.CheckEndOfBuffer();
 450922        return result;
 450923    }
 24}