Function formatAddress [src]

Prototype

pub fn formatAddress(value: anytype, options: FormatOptions, writer: anytype) @TypeOf(writer).Error!void

Parameters

options: FormatOptions

Source

pub fn formatAddress(value: anytype, options: FormatOptions, writer: anytype) @TypeOf(writer).Error!void { _ = options; const T = @TypeOf(value); switch (@typeInfo(T)) { .pointer => |info| { try writer.writeAll(@typeName(info.child) ++ "@"); if (info.size == .slice) try formatInt(@intFromPtr(value.ptr), 16, .lower, FormatOptions{}, writer) else try formatInt(@intFromPtr(value), 16, .lower, FormatOptions{}, writer); return; }, .optional => |info| { if (@typeInfo(info.child) == .pointer) { try writer.writeAll(@typeName(info.child) ++ "@"); try formatInt(@intFromPtr(value), 16, .lower, FormatOptions{}, writer); return; } }, else => {}, } @compileError("cannot format non-pointer type " ++ @typeName(T) ++ " with * specifier"); }