• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

neon-sunset / U8String / 6006406702

29 Aug 2023 12:26AM UTC coverage: 17.786% (-0.005%) from 17.791%
6006406702

push

github

neon-sunset
feat: add explicit cast operator from ImmutableArray<byte>

134 of 1066 branches covered (0.0%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

478 of 2375 relevant lines covered (20.13%)

34666.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

3.33
/src/Implementations/Standard/U8String.Operators.cs
1
using System.Collections.Immutable;
2

3
namespace U8Primitives;
4

5
public readonly partial struct U8String
6
{
7
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
8
    public static U8String operator +(U8String left, byte right)
9
    {
10
        if (!U8Info.IsAsciiByte(right))
×
11
        {
12
            ThrowHelpers.InvalidUtf8();
×
13
        }
14

15
        return U8Manipulation.ConcatUnchecked(left, right);
×
16
    }
17

18
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
19
    public static U8String operator +(U8String left, U8String right) => Concat(left, right);
×
20

21
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
22
    public static U8String operator +(U8String left, byte[] right) => Concat(left, right);
×
23

24
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
25
    public static U8String operator +(U8String left, Span<byte> right) => Concat(left, right);
×
26

27
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
28
    public static U8String operator +(U8String left, ReadOnlySpan<byte> right) => Concat(left, right);
×
29

30
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
31
    public static U8String operator +(byte[] left, U8String right) => Concat(left, right);
×
32

33
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
34
    public static U8String operator +(Span<byte> left, U8String right) => Concat(left, right);
×
35

36
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
37
    public static U8String operator +(ReadOnlySpan<byte> left, U8String right) => Concat(left, right);
×
38

39
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
40
    public static bool operator ==(U8String left, U8String right) => left.Equals(right);
×
41

42
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
43
    public static bool operator ==(U8String left, byte[] right) => left.Equals(right);
×
44

45
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
46
    public static bool operator ==(U8String left, Span<byte> right) => left.Equals(right);
×
47

48
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
49
    public static bool operator ==(U8String left, ReadOnlySpan<byte> right) => left.Equals(right);
×
50

51
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
52
    public static bool operator ==(byte[] left, U8String right) => right.Equals(left);
×
53

54
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
55
    public static bool operator ==(Span<byte> left, U8String right) => right.Equals(left);
×
56

57
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
58
    public static bool operator ==(ReadOnlySpan<byte> left, U8String right) => right.Equals(left);
×
59

60
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
61
    public static bool operator !=(U8String left, U8String right) => !(left == right);
×
62

63
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
64
    public static bool operator !=(U8String left, byte[] right) => !(left == right);
×
65

66
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
67
    public static bool operator !=(U8String left, Span<byte> right) => !(left == right);
×
68

69
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
70
    public static bool operator !=(U8String left, ReadOnlySpan<byte> right) => !(left == right);
×
71

72
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
73
    public static bool operator !=(byte[] left, U8String right) => !(left == right);
×
74

75
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
76
    public static bool operator !=(Span<byte> left, U8String right) => !(left == right);
×
77

78
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
79
    public static bool operator !=(ReadOnlySpan<byte> left, U8String right) => !(left == right);
×
80

81
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
82
    public static explicit operator U8String(ReadOnlySpan<byte> value)
83
    {
84
        return new(value);
×
85
    }
86

87
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
88
    public static explicit operator U8String(ImmutableArray<byte> value)
89
    {
90
        return new(value);
×
91
    }
92

93
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
94
    public static implicit operator ReadOnlySpan<byte>(U8String value)
95
    {
96
        return value.AsSpan();
2,044✔
97
    }
98

99
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
100
    public static implicit operator ReadOnlyMemory<byte>(U8String value)
101
    {
102
        return value.AsMemory();
×
103
    }
104
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc