< Summary

Information
Class: IceRpc.Internal.SliceEncodingExtensions
Assembly: IceRpc
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/Internal/SliceEncodingExtensions.cs
Tag: 275_13775359185
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 29
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 1
Total methods: 1
Method coverage: 100%

Metrics

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

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/Internal/SliceEncodingExtensions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using System.Buffers;
 4using ZeroC.Slice;
 5
 6namespace IceRpc.Internal;
 7
 8/// <summary>Extension methods for <see cref="SliceEncoding" />.</summary>
 9internal static class SliceEncodingExtensions
 10{
 11    /// <summary>Decodes a buffer.</summary>
 12    /// <typeparam name="T">The decoded type.</typeparam>
 13    /// <param name="encoding">The Slice encoding.</param>
 14    /// <param name="buffer">The byte buffer.</param>
 15    /// <param name="decodeFunc">The decode function for buffer.</param>
 16    /// <returns>The decoded value.</returns>
 17    /// <exception cref="InvalidDataException">Thrown when <paramref name="decodeFunc" /> finds invalid data.
 18    /// </exception>
 19    internal static T DecodeBuffer<T>(
 20        this SliceEncoding encoding,
 21        ReadOnlySequence<byte> buffer,
 22        DecodeFunc<T> decodeFunc)
 1881023    {
 1881024        var decoder = new SliceDecoder(buffer, encoding);
 1881025        T result = decodeFunc(ref decoder);
 1879826        decoder.CheckEndOfBuffer();
 1879227        return result;
 1879228    }
 29}