address6

Constructs an $(D_PSYMBOL Address6) from raw bytes in network byte order and the scope ID.

  1. Nullable!Address6 address6(R range)
  2. Nullable!Address6 address6(R range, uint scopeID)
    Nullable!Address6
    address6
    (
    R
    )
    (,
    uint scopeID = 0
    )
    if (
    isInputRange!R &&
    is(Unqual!(ElementType!R) == ubyte)
    )

Parameters

R

Input range type.

range R

$(D_KEYWORD ubyte) range containing the address.

scopeID uint

Scope ID.

Return Value

Type: Nullable!Address6

$(D_PSYMBOL Nullable) containing the address if the range contains exactly 16 bytes, or nothing otherwise.

Examples

{
    ubyte[16] actual = [ 1, 2, 3, 4, 5, 6, 7, 8,
                         9, 10, 11, 12, 13, 14, 15, 16 ];
    assert(!address6(actual[]).isNull);
}
{
    ubyte[15] actual = [ 1, 2, 3, 4, 5, 6, 7, 8,
                         9, 10, 11, 12, 13, 14, 15 ];
    assert(address6(actual[]).isNull);
}
{
    ubyte[17] actual = [ 1, 2, 3, 4, 5, 6, 7, 8, 9,
                         10, 11, 12, 13, 14, 15, 16, 17 ];
    assert(address6(actual[]).isNull);
}
{
    assert(address6(cast(ubyte[]) []).isNull);
}

Meta