11 lines
268 B
Zig
11 lines
268 B
Zig
///
|
|
/// Returns the return type of the function type `Fn`.
|
|
///
|
|
pub fn FnReturn(comptime Fn: type) type {
|
|
const type_info = @typeInfo(Fn);
|
|
|
|
if (type_info != .Fn) @compileError("`Fn` must be a function type");
|
|
|
|
return type_info.Fn.return_type orelse void;
|
|
}
|