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 › std/ › Io/ › Threaded.zig › statFromPosix
statFromPosix
Threaded.statFromPosix
pub fn statFromPosix (st : *const posix .Stat ) File .Stat
File
Code
pub fn statFromPosix (st : *const posix .Stat ) File .Stat {
const atime = st .atime ();
const mtime = st .mtime ();
const ctime = st .ctime ();
return .{
.inode = st .ino ,
.nlink = st .nlink ,
.size = @bitCast (st .size ),
.permissions = .fromMode (st .mode ),
.kind = k : {
const m = st .mode & posix .S .IFMT ;
switch (m ) {
posix .S .IFBLK => break :k .block_device ,
posix .S .IFCHR => break :k .character_device ,
posix .S .IFDIR => break :k .directory ,
posix .S .IFIFO => break :k .named_pipe ,
posix .S .IFLNK => break :k .sym_link ,
posix .S .IFREG => break :k .file ,
posix .S .IFSOCK => break :k .unix_domain_socket ,
else => {},
}
if (native_os == .illumos ) switch (m ) {
posix .S .IFDOOR => break :k .door ,
posix .S .IFPORT => break :k .event_port ,
else => {},
};
break :k .unknown ;
},
.atime = timestampFromPosix (&atime ),
.mtime = timestampFromPosix (&mtime ),
.ctime = timestampFromPosix (&ctime ),
.block_size = @intCast (st .blksize ),
};
}