DoxigAlpha

writeStructEndian

Function parameters

Parameters

#
value:anytype
endian:std.builtin.Endian

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#
adaptToNewApi
Helper for bridging to the new `Writer` API while upgrading.

Source

Implementation

#
pub fn writeStructEndian(self: Self, value: anytype, endian: std.builtin.Endian) anyerror!void {
    // TODO: make sure this value is not a reference type
    if (native_endian == endian) {
        return self.writeStruct(value);
    } else {
        var copy = value;
        mem.byteSwapAllFields(@TypeOf(value), &copy);
        return self.writeStruct(copy);
    }
}