Skip to content

Commit fa6f304

Browse files
committed
add comptime
1 parent 452a0f2 commit fa6f304

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/msgpack_rpc.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const Job = union(enum) {
6666
const JobQueue = std.fifo.LinearFifo(Job, .Dynamic);
6767

6868
/// Peer to Peer
69-
pub fn Peer(streamT: type) type {
69+
pub fn Peer(comptime streamT: type) type {
7070

7171
// TODO: whether add context ?
7272

@@ -158,7 +158,7 @@ pub fn Peer(streamT: type) type {
158158
}
159159

160160
/// get response
161-
pub fn getResponse(self: Self, errorType: type, resultType: type) !resultType {
161+
pub fn getResponse(self: Self, comptime errorType: type, comptime resultType: type) !resultType {
162162
if (@typeInfo(errorType) != .Optional) {
163163
const err_msg = comptimePrint("errorType ({}) must be optional type!", .{errorType});
164164
@compileError(err_msg);
@@ -172,14 +172,14 @@ pub fn Peer(streamT: type) type {
172172
}
173173

174174
/// Checks whether a type contains a specified declaration
175-
fn detectDecl(T: type, comptime name: []const u8) void {
175+
fn detectDecl(comptime T: type, comptime name: []const u8) void {
176176
if (!@hasDecl(T, name)) {
177177
@compileError(comptimePrint("sorry, type T ({}) must have decl called {s}", .{ T, name }));
178178
}
179179
}
180180

181181
/// make res tuple type
182-
fn makeResTupleT(errorType: type, resType: type) type {
182+
fn makeResTupleT(comptime errorType: type, comptime resType: type) type {
183183
return @Type(std.builtin.Type.Struct{
184184
.layout = .Auto,
185185
.fields = &.{

0 commit comments

Comments
 (0)