diff options
author | bptato <nincsnevem662@gmail.com> | 2024-07-10 16:41:06 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-07-10 16:41:49 +0200 |
commit | 37c144fea89bf02a449666128ac2ca8f85f2a985 (patch) | |
tree | e513e5da0ccf740ab7d393bc233e8a0da6f4aa5e /src/config/mimetypes.nim | |
parent | 997659102f16a5afc90585651e8c8502e0c8f45e (diff) | |
download | chawan-37c144fea89bf02a449666128ac2ca8f85f2a985.tar.gz |
fix compilation on 2.0.8
Diffstat (limited to 'src/config/mimetypes.nim')
-rw-r--r-- | src/config/mimetypes.nim | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/config/mimetypes.nim b/src/config/mimetypes.nim index f247822e..9beb42c7 100644 --- a/src/config/mimetypes.nim +++ b/src/config/mimetypes.nim @@ -6,9 +6,14 @@ import utils/twtstr # extension -> type type MimeTypes* = distinct Table[string, string] -proc `[]`*(mimeTypes: MimeTypes; k: string): string {.borrow.} -proc contains*(mimeTypes: MimeTypes; k: string): bool {.borrow.} -proc hasKeyOrPut*(mimeTypes: var MimeTypes; k, v: string): bool {.borrow.} +template `[]`*(mimeTypes: MimeTypes; k: string): string = + Table[string, string](mimeTypes)[k] + +template contains*(mimeTypes: MimeTypes; k: string): bool = + k in Table[string, string](mimeTypes) + +template hasKeyOrPut*(mimeTypes: var MimeTypes; k, v: string): bool = + Table[string, string](mimeTypes).hasKeyOrPut(k, v) # Add mime types found in stream to mimeTypes. # No error handling for now. |