< Summary

Information
Class: System.Buffers.BoundedMemory<T>
Assembly: DotnetFuzzing
File(s): D:\runner\runtime\src\libraries\Common\tests\TestUtilities\System\Buffers\BoundedMemory.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 69
Line coverage: 0%
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 Cyclomatic complexity NPath complexity Sequence coverage
op_Implicit(...)100%110%
op_Implicit(...)100%110%

File(s)

D:\runner\runtime\src\libraries\Common\tests\TestUtilities\System\Buffers\BoundedMemory.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4namespace System.Buffers
 5{
 6    /// <summary>
 7    /// Represents a region of native memory. The <see cref="Memory"/> property can be used
 8    /// to get a <see cref="Memory{Byte}"/> backed by this memory region.
 9    /// </summary>
 10    public abstract class BoundedMemory<T> : IDisposable where T : unmanaged
 11    {
 12        /// <summary>
 13        /// Returns a value stating whether this native memory block is readonly.
 14        /// </summary>
 15        public abstract bool IsReadonly { get; }
 16
 17        /// <summary>Gets the length of the <see cref="BoundedMemory{T}"/> instance.</summary>
 18        public abstract int Length { get; }
 19
 20        /// <summary>
 21        /// Gets the <see cref="Memory{Byte}"/> which represents this native memory.
 22        /// This <see cref="BoundedMemory{T}"/> instance must be kept alive while working with the <see cref="Memory{Byt
 23        /// </summary>
 24        public abstract Memory<T> Memory { get; }
 25
 26        /// <summary>
 27        /// Gets the <see cref="Span{Byte}"/> which represents this native memory.
 28        /// This <see cref="BoundedMemory{T}"/> instance must be kept alive while working with the <see cref="Span{Byte}
 29        /// </summary>
 30        public abstract Span<T> Span { get; }
 31
 32        /// <summary>
 33        /// Disposes this <see cref="BoundedMemory{T}"/> instance.
 34        /// </summary>
 35        public abstract void Dispose();
 36
 37        /// <summary>
 38        /// Sets this native memory block to be readonly. Writes to this block will cause an AV.
 39        /// This method has no effect if the memory block is zero length or if the underlying
 40        /// OS does not support marking the memory block as readonly.
 41        /// </summary>
 42        public abstract void MakeReadonly();
 43
 44        /// <summary>
 45        /// Sets this native memory block to be read+write.
 46        /// This method has no effect if the memory block is zero length or if the underlying
 47        /// OS does not support marking the memory block as read+write.
 48        /// </summary>
 49        public abstract void MakeWriteable();
 50
 51        /// <summary>
 52        /// Gets the <see cref="Span{Byte}"/> which represents this native memory.
 53        /// This <see cref="BoundedMemory{T}"/> instance must be kept alive while working with the <see cref="Span{Byte}
 54        /// </summary>
 055        public static implicit operator Span<T>(BoundedMemory<T> boundedMemory) => boundedMemory.Span;
 56
 57        /// <summary>
 58        /// Gets the <see cref="ReadOnlySpan{Byte}"/> which represents this native memory.
 59        /// This <see cref="BoundedMemory{T}"/> instance must be kept alive while working with the <see cref="ReadOnlySp
 60        /// </summary>
 061        public static implicit operator ReadOnlySpan<T>(BoundedMemory<T> boundedMemory) => boundedMemory.Span;
 62
 63        /// <summary>
 64        /// Gets a reference to the element at the specified index.
 65        /// This <see cref="BoundedMemory{T}"/> instance must be kept alive while working with the reference.
 66        /// </summary>
 067        public ref T this[int index] => ref Span[index];
 68    }
 69}