inline tiny proc (#15498)

This commit is contained in:
Juan Carlos 2020-10-06 11:52:12 -03:00 • committed by GitHub
commit 695f955f70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -232,7 +232,7 @@ proc code*(response: Response | AsyncResponse): HttpCode
## corresponding ``HttpCode``. ## corresponding ``HttpCode``.
return response.status[0 .. 2].parseInt.HttpCode return response.status[0 .. 2].parseInt.HttpCode
proc contentType*(response: Response | AsyncResponse): string = proc contentType*(response: Response | AsyncResponse): string {.inline.} =
## Retrieves the specified response's content type. ## Retrieves the specified response's content type.
## ##
## This is effectively the value of the "Content-Type" header. ## This is effectively the value of the "Content-Type" header.
@ -329,7 +329,7 @@ proc newProxy*(url: string, auth = ""): Proxy =
## Constructs a new ``TProxy`` object. ## Constructs a new ``TProxy`` object.
result = Proxy(url: parseUri(url), auth: auth) result = Proxy(url: parseUri(url), auth: auth)
proc newMultipartData*: MultipartData = proc newMultipartData*: MultipartData {.inline.} =
## Constructs a new ``MultipartData`` object. ## Constructs a new ``MultipartData`` object.
MultipartData() MultipartData()
@ -415,7 +415,7 @@ proc addFiles*(p: MultipartData, xs: openArray[tuple[name, file: string]],
p.add(name, content, fName & ext, contentType, useStream = useStream) p.add(name, content, fName & ext, contentType, useStream = useStream)
result = p result = p
proc `[]=`*(p: MultipartData, name, content: string) = proc `[]=`*(p: MultipartData, name, content: string) {.inline.} =
## Add a multipart entry to the multipart data ``p``. The value is added ## Add a multipart entry to the multipart data ``p``. The value is added
## without a filename and without a content type. ## without a filename and without a content type.
## ##
@ -424,7 +424,7 @@ proc `[]=`*(p: MultipartData, name, content: string) =
p.add(name, content) p.add(name, content)
proc `[]=`*(p: MultipartData, name: string, proc `[]=`*(p: MultipartData, name: string,
file: tuple[name, contentType, content: string]) = file: tuple[name, contentType, content: string]) {.inline.} =
## Add a file to the multipart data ``p``, specifying filename, contentType ## Add a file to the multipart data ``p``, specifying filename, contentType
## and content manually. ## and content manually.
## ##
@ -635,7 +635,7 @@ proc close*(client: HttpClient | AsyncHttpClient) =
client.socket.close() client.socket.close()
client.connected = false client.connected = false
proc getSocket*(client: HttpClient): Socket = proc getSocket*(client: HttpClient): Socket {.inline.} =
## Get network socket, useful if you want to find out more details about the connection ## Get network socket, useful if you want to find out more details about the connection
## ##
## this example shows info about local and remote endpoints ## this example shows info about local and remote endpoints
@ -647,7 +647,7 @@ proc getSocket*(client: HttpClient): Socket =
## ##
return client.socket return client.socket
proc getSocket*(client: AsyncHttpClient): AsyncSocket = proc getSocket*(client: AsyncHttpClient): AsyncSocket {.inline.} =
return client.socket return client.socket
proc reportProgress(client: HttpClient | AsyncHttpClient, proc reportProgress(client: HttpClient | AsyncHttpClient,