Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

concatByMoving

Concatenate list2 onto the end of list1, removing all entries from the former.

Arguments: list1: the list to concatenate onto list2: the list to be concatenated

DoublyLinkedList.concatByMoving
pub fn concatByMoving(list1: *DoublyLinkedList, list2: *DoublyLinkedList) void

File

lib/std/DoublyLinkedList.zig:62

Code

pub fn concatByMoving(list1: *DoublyLinkedList, list2: *DoublyLinkedList) void {
    const l2_first = list2.first orelse return;
    if (list1.last) |l1_last| {
        l1_last.next = list2.first;
        l2_first.prev = list1.last;
    } else {
        // list1 was empty
        list1.first = list2.first;
    }
    list1.last = list2.last;
    list2.first = null;
    list2.last = null;
}