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.
Zig › compiler/ › translate-c/ › Translator.zig › transNarrowStringLiteral
transNarrowStringLiteral
Translator.transNarrowStringLiteral
fn transNarrowStringLiteral (
t : *Translator ,
expr : Node .Index ,
literal : Node .CharLiteral ,
) TransError !ZigNode
File
Code
fn transNarrowStringLiteral (
t : *Translator ,
expr : Node .Index ,
literal : Node .CharLiteral ,
) TransError !ZigNode {
const val = t .tree .value_map .get (expr ).?;
const bytes = t .comp .interner .get (val .ref ()).bytes ;
var allocating : std .Io .Writer .Allocating = try .initCapacity (t .gpa , bytes .len );
defer allocating .deinit ();
aro .Value .printString (bytes , literal .qt , t .comp , &allocating .writer ) catch return error .OutOfMemory ;
return ZigTag .string_literal .create (t .arena , try t .arena .dupe (u8 , allocating .written ()));
}