From 05c91418be18c1f0507d477182952c1e2f8cb11d Mon Sep 17 00:00:00 2001 From: Eugene Kabanov Date: Thu, 26 Aug 2021 14:22:29 +0300 Subject: [PATCH] Export async-related imports to allow partial imports. (#218) --- chronos/apps/http/httpclient.nim | 4 +++- chronos/apps/http/httpcommon.nim | 2 +- chronos/apps/http/httpserver.nim | 4 ++-- chronos/apps/http/multipart.nim | 2 +- chronos/apps/http/shttpserver.nim | 2 +- chronos/asyncsync.nim | 1 + chronos/debugutils.nim | 1 + chronos/streams/asyncstream.nim | 2 +- chronos/streams/boundstream.nim | 2 +- chronos/streams/chunkstream.nim | 2 +- chronos/streams/tlsstream.nim | 1 + chronos/transports/ipnet.nim | 3 ++- chronos/transports/osnet.nim | 2 +- 13 files changed, 17 insertions(+), 11 deletions(-) diff --git a/chronos/apps/http/httpclient.nim b/chronos/apps/http/httpclient.nim index 6ce6a98..84a60b6 100644 --- a/chronos/apps/http/httpclient.nim +++ b/chronos/apps/http/httpclient.nim @@ -11,7 +11,9 @@ import stew/[results, base10, base64], httputils import ../../asyncloop, ../../asyncsync import ../../streams/[asyncstream, tlsstream, chunkstream, boundstream] import httptable, httpcommon, httpagent, httpbodyrw, multipart -export httptable, httpcommon, httpagent, httpbodyrw, multipart +export results, asyncloop, asyncsync, asyncstream, tlsstream, chunkstream, + boundstream, httptable, httpcommon, httpagent, httpbodyrw, multipart, + httputils const HttpMaxHeadersSize* = 8192 diff --git a/chronos/apps/http/httpcommon.nim b/chronos/apps/http/httpcommon.nim index 0653aa6..18d6252 100644 --- a/chronos/apps/http/httpcommon.nim +++ b/chronos/apps/http/httpcommon.nim @@ -10,7 +10,7 @@ import std/[strutils, uri] import stew/[results, endians2], httputils import ../../asyncloop, ../../asyncsync import ../../streams/[asyncstream, boundstream] -export results, httputils, strutils +export asyncloop, asyncsync, results, httputils, strutils const HeadersMark* = @[0x0d'u8, 0x0a'u8, 0x0d'u8, 0x0a'u8] diff --git a/chronos/apps/http/httpserver.nim b/chronos/apps/http/httpserver.nim index bb1d17b..65ff41b 100644 --- a/chronos/apps/http/httpserver.nim +++ b/chronos/apps/http/httpserver.nim @@ -11,8 +11,8 @@ import stew/[results, base10], httputils import ../../asyncloop, ../../asyncsync import ../../streams/[asyncstream, boundstream, chunkstream] import httptable, httpcommon, multipart -export httptable, httpcommon, httputils, multipart, asyncstream, - uri, tables, options, results +export asyncloop, asyncsync, httptable, httpcommon, httputils, multipart, + asyncstream, boundstream, chunkstream, uri, tables, options, results type HttpServerFlags* {.pure.} = enum diff --git a/chronos/apps/http/multipart.nim b/chronos/apps/http/multipart.nim index 13c84f8..0d80b30 100644 --- a/chronos/apps/http/multipart.nim +++ b/chronos/apps/http/multipart.nim @@ -12,7 +12,7 @@ import stew/results import ../../asyncloop import ../../streams/[asyncstream, boundstream, chunkstream] import httptable, httpcommon, httpbodyrw -export httptable, httpcommon, httpbodyrw, asyncstream +export asyncloop, httptable, httpcommon, httpbodyrw, asyncstream const UnableToReadMultipartBody = "Unable to read multipart message body" diff --git a/chronos/apps/http/shttpserver.nim b/chronos/apps/http/shttpserver.nim index ca22ccc..4dc6945 100644 --- a/chronos/apps/http/shttpserver.nim +++ b/chronos/apps/http/shttpserver.nim @@ -9,7 +9,7 @@ import httpserver import ../../asyncloop, ../../asyncsync import ../../streams/[asyncstream, tlsstream] -export httpserver, asyncstream, tlsstream +export asyncloop, asyncsync, httpserver, asyncstream, tlsstream type SecureHttpServer* = object of HttpServer diff --git a/chronos/asyncsync.nim b/chronos/asyncsync.nim index 44f09ae..c28bc65 100644 --- a/chronos/asyncsync.nim +++ b/chronos/asyncsync.nim @@ -14,6 +14,7 @@ import std/[sequtils, deques] import ./asyncloop +export asyncloop type AsyncLock* = ref object of RootRef diff --git a/chronos/debugutils.nim b/chronos/debugutils.nim index 87a7225..207b712 100644 --- a/chronos/debugutils.nim +++ b/chronos/debugutils.nim @@ -10,6 +10,7 @@ {.push raises: [Defect].} import ./asyncloop +export asyncloop const AllFutureStates* = {FutureState.Pending, FutureState.Cancelled, diff --git a/chronos/streams/asyncstream.nim b/chronos/streams/asyncstream.nim index acc92ef..0e64aa2 100644 --- a/chronos/streams/asyncstream.nim +++ b/chronos/streams/asyncstream.nim @@ -11,7 +11,7 @@ import ../asyncloop, ../asyncsync import ../transports/common, ../transports/stream -export asyncsync, stream, common +export asyncloop, asyncsync, stream, common const AsyncStreamDefaultBufferSize* = 4096 diff --git a/chronos/streams/boundstream.nim b/chronos/streams/boundstream.nim index e1997a0..7d2586c 100644 --- a/chronos/streams/boundstream.nim +++ b/chronos/streams/boundstream.nim @@ -17,7 +17,7 @@ import std/options import ../asyncloop, ../timer import asyncstream, ../transports/stream, ../transports/common -export asyncstream, stream, timer, common +export asyncloop, asyncstream, stream, timer, common type BoundCmp* {.pure.} = enum diff --git a/chronos/streams/chunkstream.nim b/chronos/streams/chunkstream.nim index 759f709..75a3db7 100644 --- a/chronos/streams/chunkstream.nim +++ b/chronos/streams/chunkstream.nim @@ -11,7 +11,7 @@ import ../asyncloop, ../timer import asyncstream, ../transports/stream, ../transports/common import stew/results -export asyncstream, stream, timer, common +export asyncloop, asyncstream, stream, timer, common, results const ChunkBufferSize = 4096 diff --git a/chronos/streams/tlsstream.nim b/chronos/streams/tlsstream.nim index 70a7d68..1c0768a 100644 --- a/chronos/streams/tlsstream.nim +++ b/chronos/streams/tlsstream.nim @@ -12,6 +12,7 @@ import bearssl, bearssl/cacert import ../asyncloop, ../timer, ../asyncsync import asyncstream, ../transports/stream, ../transports/common +export asyncloop, asyncsync, timer, asyncstream, bearssl type TLSStreamKind {.pure.} = enum diff --git a/chronos/transports/ipnet.nim b/chronos/transports/ipnet.nim index 1a00ca5..270ccde 100644 --- a/chronos/transports/ipnet.nim +++ b/chronos/transports/ipnet.nim @@ -11,7 +11,8 @@ {.push raises: [Defect].} -import stew/endians2, std/strutils +import std/strutils +import stew/endians2 import ./common export common diff --git a/chronos/transports/osnet.nim b/chronos/transports/osnet.nim index 7f8bdfd..fdf8bb8 100644 --- a/chronos/transports/osnet.nim +++ b/chronos/transports/osnet.nim @@ -13,7 +13,7 @@ {.push raises: [Defect].} import std/algorithm -from strutils import toHex +from std/strutils import toHex import ./ipnet export ipnet