mirror of
https://github.com/neovim/neovim
synced 2025-07-15 08:41:47 +00:00
docs(luv): replace bundled LuaCATS meta files with upstream
Synced from https://github.com/luvit/luv/blob/master/meta.lua
This commit is contained in:
committed by
Christian Clason
parent
8707ec2644
commit
a81d2b6703
@ -49,6 +49,7 @@ exclude_files = {
|
||||
'runtime/lua/vim/_meta/vimfn.lua',
|
||||
'runtime/lua/vim/_meta/api.lua',
|
||||
'runtime/lua/vim/re.lua',
|
||||
'runtime/lua/uv/_meta.lua',
|
||||
'runtime/lua/coxpcall.lua',
|
||||
'src/nvim/eval.lua',
|
||||
}
|
||||
|
@ -5,11 +5,12 @@
|
||||
},
|
||||
"workspace": {
|
||||
"library": [
|
||||
"runtime/lua",
|
||||
"${3rd}/busted/library"
|
||||
],
|
||||
"ignoreDir": [
|
||||
"test",
|
||||
".deps",
|
||||
"build",
|
||||
"test"
|
||||
],
|
||||
"checkThirdParty": "Disable"
|
||||
},
|
||||
|
@ -1,6 +1,7 @@
|
||||
/build/
|
||||
/.deps/
|
||||
/runtime/lua/coxpcall.lua
|
||||
/runtime/lua/uv/_meta.lua
|
||||
/runtime/lua/vim/_meta
|
||||
/runtime/lua/vim/re.lua
|
||||
|
||||
|
@ -127,7 +127,9 @@ Some can be auto-bumped by `scripts/bump_deps.lua`.
|
||||
* [LuaJIT](https://github.com/LuaJIT/LuaJIT)
|
||||
* [Lua](https://www.lua.org/download.html)
|
||||
* [Luv](https://github.com/luvit/luv)
|
||||
* When bumping, also sync [our bundled documentation](https://github.com/neovim/neovim/blob/master/runtime/doc/luvref.txt) with [the upstream documentation](https://github.com/luvit/luv/blob/master/docs.md).
|
||||
* When bumping, also sync
|
||||
- [our bundled meta file](https://github.com/neovim/neovim/blob/master/runtime/lua/uv/_meta.lua) with [the upstream meta file](https://github.com/luvit/luv/blob/master/meta.lua);
|
||||
- [our bundled documentation](https://github.com/neovim/neovim/blob/master/runtime/doc/luvref.txt) with [the upstream documentation](https://github.com/luvit/luv/blob/master/docs.md).
|
||||
* [gettext](https://ftp.gnu.org/pub/gnu/gettext/)
|
||||
* [libiconv](https://ftp.gnu.org/pub/gnu/libiconv)
|
||||
* [libuv](https://github.com/libuv/libuv)
|
||||
|
4448
runtime/lua/uv/_meta.lua
Normal file
4448
runtime/lua/uv/_meta.lua
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,260 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
---@alias uv.errno.E2BIG "E2BIG" # argument list too long.
|
||||
---@alias uv.errno.EACCES "EACCES" # permission denied.
|
||||
---@alias uv.errno.EADDRINUSE "EADDRINUSE" # address already in use.
|
||||
---@alias uv.errno.EADDRNOTAVAIL "EADDRNOTAVAIL" # address not available.
|
||||
---@alias uv.errno.EAFNOSUPPORT "EAFNOSUPPORT" # address family not supported.
|
||||
---@alias uv.errno.EAGAIN "EAGAIN" # resource temporarily unavailable.
|
||||
---@alias uv.errno.EAI_ADDRFAMILY "EAI_ADDRFAMILY" # address family not supported.
|
||||
---@alias uv.errno.EAI_AGAIN "EAI_AGAIN" # temporary failure.
|
||||
---@alias uv.errno.EAI_BADFLAGS "EAI_BADFLAGS" # bad ai_flags value.
|
||||
---@alias uv.errno.EAI_BADHINTS "EAI_BADHINTS" # invalid value for hints.
|
||||
---@alias uv.errno.EAI_CANCELED "EAI_CANCELED" # request canceled.
|
||||
---@alias uv.errno.EAI_FAIL "EAI_FAIL" # permanent failure.
|
||||
---@alias uv.errno.EAI_FAMILY "EAI_FAMILY" # ai_family not supported.
|
||||
---@alias uv.errno.EAI_MEMORY "EAI_MEMORY" # out of memory.
|
||||
---@alias uv.errno.EAI_NODATA "EAI_NODATA" # no address.
|
||||
---@alias uv.errno.EAI_NONAME "EAI_NONAME" # unknown node or service.
|
||||
---@alias uv.errno.EAI_OVERFLOW "EAI_OVERFLOW" # argument buffer overflow.
|
||||
---@alias uv.errno.EAI_PROTOCOL "EAI_PROTOCOL" # resolved protocol is unknown.
|
||||
---@alias uv.errno.EAI_SERVICE "EAI_SERVICE" # service not available for socket type.
|
||||
---@alias uv.errno.EAI_SOCKTYPE "EAI_SOCKTYPE" # socket type not supported.
|
||||
---@alias uv.errno.EALREADY "EALREADY" # connection already in progress.
|
||||
---@alias uv.errno.EBADF "EBADF" # bad file descriptor.
|
||||
---@alias uv.errno.EBUSY "EBUSY" # resource busy or locked.
|
||||
---@alias uv.errno.ECANCELED "ECANCELED" # operation canceled.
|
||||
---@alias uv.errno.ECHARSET "ECHARSET" # invalid Unicode character.
|
||||
---@alias uv.errno.ECONNABORTED "ECONNABORTED" # software caused connection abort.
|
||||
---@alias uv.errno.ECONNREFUSED "ECONNREFUSED" # connection refused.
|
||||
---@alias uv.errno.ECONNRESET "ECONNRESET" # connection reset by peer.
|
||||
---@alias uv.errno.EDESTADDRREQ "EDESTADDRREQ" # destination address required.
|
||||
---@alias uv.errno.EEXIST "EEXIST" # file already exists.
|
||||
---@alias uv.errno.EFAULT "EFAULT" # bad address in system call argument.
|
||||
---@alias uv.errno.EFBIG "EFBIG" # file too large.
|
||||
---@alias uv.errno.EFTYPE "EFTYPE" # inappropriate file type or format.
|
||||
---@alias uv.errno.EHOSTUNREACH "EHOSTUNREACH" # host is unreachable.
|
||||
---@alias uv.errno.EILSEQ "EILSEQ" # illegal byte sequence.
|
||||
---@alias uv.errno.EINTR "EINTR" # interrupted system call.
|
||||
---@alias uv.errno.EINVAL "EINVAL" # invalid argument.
|
||||
---@alias uv.errno.EIO "EIO" # i/o error.
|
||||
---@alias uv.errno.EISCONN "EISCONN" # socket is already connected.
|
||||
---@alias uv.errno.EISDIR "EISDIR" # illegal operation on a directory.
|
||||
---@alias uv.errno.ELOOP "ELOOP" # too many symbolic links encountered.
|
||||
---@alias uv.errno.EMFILE "EMFILE" # too many open files.
|
||||
---@alias uv.errno.EMLINK "EMLINK" # too many links.
|
||||
---@alias uv.errno.EMSGSIZE "EMSGSIZE" # message too long.
|
||||
---@alias uv.errno.ENAMETOOLONG "ENAMETOOLONG" # name too long.
|
||||
---@alias uv.errno.ENETDOWN "ENETDOWN" # network is down.
|
||||
---@alias uv.errno.ENETUNREACH "ENETUNREACH" # network is unreachable.
|
||||
---@alias uv.errno.ENFILE "ENFILE" # file table overflow.
|
||||
---@alias uv.errno.ENOBUFS "ENOBUFS" # no buffer space available.
|
||||
---@alias uv.errno.ENODEV "ENODEV" # no such device.
|
||||
---@alias uv.errno.ENOENT "ENOENT" # no such file or directory.
|
||||
---@alias uv.errno.ENOMEM "ENOMEM" # not enough memory.
|
||||
---@alias uv.errno.ENONET "ENONET" # machine is not on the network.
|
||||
---@alias uv.errno.ENOPROTOOPT "ENOPROTOOPT" # protocol not available.
|
||||
---@alias uv.errno.ENOSPC "ENOSPC" # no space left on device.
|
||||
---@alias uv.errno.ENOSYS "ENOSYS" # function not implemented.
|
||||
---@alias uv.errno.ENOTCONN "ENOTCONN" # socket is not connected.
|
||||
---@alias uv.errno.ENOTDIR "ENOTDIR" # not a directory.
|
||||
---@alias uv.errno.ENOTEMPTY "ENOTEMPTY" # directory not empty.
|
||||
---@alias uv.errno.ENOTSOCK "ENOTSOCK" # socket operation on non-socket.
|
||||
---@alias uv.errno.ENOTSUP "ENOTSUP" # operation not supported on socket.
|
||||
---@alias uv.errno.ENOTTY "ENOTTY" # inappropriate ioctl for device.
|
||||
---@alias uv.errno.ENXIO "ENXIO" # no such device or address.
|
||||
---@alias uv.errno.EOF "EOF" # end of file.
|
||||
---@alias uv.errno.EOVERFLOW "EOVERFLOW" # value too large for defined data type.
|
||||
---@alias uv.errno.EPERM "EPERM" # operation not permitted.
|
||||
---@alias uv.errno.EPIPE "EPIPE" # broken pipe.
|
||||
---@alias uv.errno.EPROTO "EPROTO" # protocol error.
|
||||
---@alias uv.errno.EPROTONOSUPPORT "EPROTONOSUPPORT" # protocol not supported.
|
||||
---@alias uv.errno.EPROTOTYPE "EPROTOTYPE" # protocol wrong type for socket.
|
||||
---@alias uv.errno.ERANGE "ERANGE" # result too large.
|
||||
---@alias uv.errno.EROFS "EROFS" # read-only file system.
|
||||
---@alias uv.errno.ESHUTDOWN "ESHUTDOWN" # cannot send after transport endpoint shutdown.
|
||||
---@alias uv.errno.ESOCKTNOSUPPORT "ESOCKTNOSUPPORT" # socket type not supported.
|
||||
---@alias uv.errno.ESPIPE "ESPIPE" # invalid seek.
|
||||
---@alias uv.errno.ESRCH "ESRCH" # no such process.
|
||||
---@alias uv.errno.ETIMEDOUT "ETIMEDOUT" # connection timed out.
|
||||
---@alias uv.errno.ETXTBSY "ETXTBSY" # text file is busy.
|
||||
---@alias uv.errno.EXDEV "EXDEV" # cross-device link not permitted.
|
||||
---@alias uv.errno.UNKNOWN "UNKNOWN" # unknown error.
|
||||
|
||||
--- An error string with the format {name}: {message}
|
||||
---
|
||||
--- * {name} is the error name provided internally by uv_err_name (e.g. "ENOENT")
|
||||
--- * {message} is a human-readable message provided internally by uv_strerror
|
||||
---
|
||||
---@alias uv.error.message string
|
||||
|
||||
--- An error name string
|
||||
---
|
||||
---@alias uv.error.name
|
||||
---| "E2BIG" # argument list too long
|
||||
---| "EACCES" # permission denied
|
||||
---| "EADDRINUSE" # address already in use
|
||||
---| "EADDRNOTAVAIL" # address not available
|
||||
---| "EAFNOSUPPORT" # address family not supported
|
||||
---| "EAGAIN" # resource temporarily unavailable
|
||||
---| "EAI_ADDRFAMILY" # address family not supported
|
||||
---| "EAI_AGAIN" # temporary failure
|
||||
---| "EAI_BADFLAGS" # bad ai_flags value
|
||||
---| "EAI_BADHINTS" # invalid value for hints
|
||||
---| "EAI_CANCELED" # request canceled
|
||||
---| "EAI_FAIL" # permanent failure
|
||||
---| "EAI_FAMILY" # ai_family not supported
|
||||
---| "EAI_MEMORY" # out of memory
|
||||
---| "EAI_NODATA" # no address
|
||||
---| "EAI_NONAME" # unknown node or service
|
||||
---| "EAI_OVERFLOW" # argument buffer overflow
|
||||
---| "EAI_PROTOCOL" # resolved protocol is unknown
|
||||
---| "EAI_SERVICE" # service not available for socket type
|
||||
---| "EAI_SOCKTYPE" # socket type not supported
|
||||
---| "EALREADY" # connection already in progress
|
||||
---| "EBADF" # bad file descriptor
|
||||
---| "EBUSY" # resource busy or locked
|
||||
---| "ECANCELED" # operation canceled
|
||||
---| "ECHARSET" # invalid Unicode character
|
||||
---| "ECONNABORTED" # software caused connection abort
|
||||
---| "ECONNREFUSED" # connection refused
|
||||
---| "ECONNRESET" # connection reset by peer
|
||||
---| "EDESTADDRREQ" # destination address required
|
||||
---| "EEXIST" # file already exists
|
||||
---| "EFAULT" # bad address in system call argument
|
||||
---| "EFBIG" # file too large
|
||||
---| "EFTYPE" # inappropriate file type or format
|
||||
---| "EHOSTUNREACH" # host is unreachable
|
||||
---| "EILSEQ" # illegal byte sequence
|
||||
---| "EINTR" # interrupted system call
|
||||
---| "EINVAL" # invalid argument
|
||||
---| "EIO" # i/o error
|
||||
---| "EISCONN" # socket is already connected
|
||||
---| "EISDIR" # illegal operation on a directory
|
||||
---| "ELOOP" # too many symbolic links encountered
|
||||
---| "EMFILE" # too many open files
|
||||
---| "EMLINK" # too many links
|
||||
---| "EMSGSIZE" # message too long
|
||||
---| "ENAMETOOLONG" # name too long
|
||||
---| "ENETDOWN" # network is down
|
||||
---| "ENETUNREACH" # network is unreachable
|
||||
---| "ENFILE" # file table overflow
|
||||
---| "ENOBUFS" # no buffer space available
|
||||
---| "ENODEV" # no such device
|
||||
---| "ENOENT" # no such file or directory
|
||||
---| "ENOMEM" # not enough memory
|
||||
---| "ENONET" # machine is not on the network
|
||||
---| "ENOPROTOOPT" # protocol not available
|
||||
---| "ENOSPC" # no space left on device
|
||||
---| "ENOSYS" # function not implemented
|
||||
---| "ENOTCONN" # socket is not connected
|
||||
---| "ENOTDIR" # not a directory
|
||||
---| "ENOTEMPTY" # directory not empty
|
||||
---| "ENOTSOCK" # socket operation on non-socket
|
||||
---| "ENOTSUP" # operation not supported on socket
|
||||
---| "ENOTTY" # inappropriate ioctl for device
|
||||
---| "ENXIO" # no such device or address
|
||||
---| "EOF" # end of file
|
||||
---| "EOVERFLOW" # value too large for defined data type
|
||||
---| "EPERM" # operation not permitted
|
||||
---| "EPIPE" # broken pipe
|
||||
---| "EPROTO" # protocol error
|
||||
---| "EPROTONOSUPPORT" # protocol not supported
|
||||
---| "EPROTOTYPE" # protocol wrong type for socket
|
||||
---| "ERANGE" # result too large
|
||||
---| "EROFS" # read-only file system
|
||||
---| "ESHUTDOWN" # cannot send after transport endpoint shutdown
|
||||
---| "ESOCKTNOSUPPORT" # socket type not supported
|
||||
---| "ESPIPE" # invalid seek
|
||||
---| "ESRCH" # no such process
|
||||
---| "ETIMEDOUT" # connection timed out
|
||||
---| "ETXTBSY" # text file is busy
|
||||
---| "EXDEV" # cross-device link not permitted
|
||||
---| "UNKNOWN" # unknown error
|
||||
|
||||
--- A table value which exposes error constants as a map, where the key is the error name (without the UV_ prefix) and its value is a negative number.
|
||||
---
|
||||
---@class uv.errno : table
|
||||
---
|
||||
---@field E2BIG integer # argument list too long.
|
||||
---@field EACCES integer # permission denied.
|
||||
---@field EADDRINUSE integer # address already in use.
|
||||
---@field EADDRNOTAVAIL integer # address not available.
|
||||
---@field EAFNOSUPPORT integer # address family not supported.
|
||||
---@field EAGAIN integer # resource temporarily unavailable.
|
||||
---@field EAI_ADDRFAMILY integer # address family not supported.
|
||||
---@field EAI_AGAIN integer # temporary failure.
|
||||
---@field EAI_BADFLAGS integer # bad ai_flags value.
|
||||
---@field EAI_BADHINTS integer # invalid value for hints.
|
||||
---@field EAI_CANCELED integer # request canceled.
|
||||
---@field EAI_FAIL integer # permanent failure.
|
||||
---@field EAI_FAMILY integer # ai_family not supported.
|
||||
---@field EAI_MEMORY integer # out of memory.
|
||||
---@field EAI_NODATA integer # no address.
|
||||
---@field EAI_NONAME integer # unknown node or service.
|
||||
---@field EAI_OVERFLOW integer # argument buffer overflow.
|
||||
---@field EAI_PROTOCOL integer # resolved protocol is unknown.
|
||||
---@field EAI_SERVICE integer # service not available for socket type.
|
||||
---@field EAI_SOCKTYPE integer # socket type not supported.
|
||||
---@field EALREADY integer # connection already in progress.
|
||||
---@field EBADF integer # bad file descriptor.
|
||||
---@field EBUSY integer # resource busy or locked.
|
||||
---@field ECANCELED integer # operation canceled.
|
||||
---@field ECHARSET integer # invalid Unicode character.
|
||||
---@field ECONNABORTED integer # software caused connection abort.
|
||||
---@field ECONNREFUSED integer # connection refused.
|
||||
---@field ECONNRESET integer # connection reset by peer.
|
||||
---@field EDESTADDRREQ integer # destination address required.
|
||||
---@field EEXIST integer # file already exists.
|
||||
---@field EFAULT integer # bad address in system call argument.
|
||||
---@field EFBIG integer # file too large.
|
||||
---@field EFTYPE integer # inappropriate file type or format.
|
||||
---@field EHOSTUNREACH integer # host is unreachable.
|
||||
---@field EILSEQ integer # illegal byte sequence.
|
||||
---@field EINTR integer # interrupted system call.
|
||||
---@field EINVAL integer # invalid argument.
|
||||
---@field EIO integer # i/o error.
|
||||
---@field EISCONN integer # socket is already connected.
|
||||
---@field EISDIR integer # illegal operation on a directory.
|
||||
---@field ELOOP integer # too many symbolic links encountered.
|
||||
---@field EMFILE integer # too many open files.
|
||||
---@field EMLINK integer # too many links.
|
||||
---@field EMSGSIZE integer # message too long.
|
||||
---@field ENAMETOOLONG integer # name too long.
|
||||
---@field ENETDOWN integer # network is down.
|
||||
---@field ENETUNREACH integer # network is unreachable.
|
||||
---@field ENFILE integer # file table overflow.
|
||||
---@field ENOBUFS integer # no buffer space available.
|
||||
---@field ENODEV integer # no such device.
|
||||
---@field ENOENT integer # no such file or directory.
|
||||
---@field ENOMEM integer # not enough memory.
|
||||
---@field ENONET integer # machine is not on the network.
|
||||
---@field ENOPROTOOPT integer # protocol not available.
|
||||
---@field ENOSPC integer # no space left on device.
|
||||
---@field ENOSYS integer # function not implemented.
|
||||
---@field ENOTCONN integer # socket is not connected.
|
||||
---@field ENOTDIR integer # not a directory.
|
||||
---@field ENOTEMPTY integer # directory not empty.
|
||||
---@field ENOTSOCK integer # socket operation on non-socket.
|
||||
---@field ENOTSUP integer # operation not supported on socket.
|
||||
---@field ENOTTY integer # inappropriate ioctl for device.
|
||||
---@field ENXIO integer # no such device or address.
|
||||
---@field EOF integer # end of file.
|
||||
---@field EOVERFLOW integer # value too large for defined data type.
|
||||
---@field EPERM integer # operation not permitted.
|
||||
---@field EPIPE integer # broken pipe.
|
||||
---@field EPROTO integer # protocol error.
|
||||
---@field EPROTONOSUPPORT integer # protocol not supported.
|
||||
---@field EPROTOTYPE integer # protocol wrong type for socket.
|
||||
---@field ERANGE integer # result too large.
|
||||
---@field EROFS integer # read-only file system.
|
||||
---@field ESHUTDOWN integer # cannot send after transport endpoint shutdown.
|
||||
---@field ESOCKTNOSUPPORT integer # socket type not supported.
|
||||
---@field ESPIPE integer # invalid seek.
|
||||
---@field ESRCH integer # no such process.
|
||||
---@field ETIMEDOUT integer # connection timed out.
|
||||
---@field ETXTBSY integer # text file is busy.
|
||||
---@field EXDEV integer # cross-device link not permitted.
|
||||
---@field UNKNOWN integer # unknown error.
|
@ -1,36 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- luv_dir_t
|
||||
---
|
||||
---@class uv.luv_dir_t : userdata
|
||||
local dir = {} -- luacheck: no unused
|
||||
|
||||
--- Closes a directory stream returned by a successful `uv.fs_opendir()` call.
|
||||
---
|
||||
---@return boolean|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
---
|
||||
---@overload fun(self:uv.luv_dir_t, callback:uv.fs_closedir.callback):uv.uv_fs_t
|
||||
function dir:closedir() end
|
||||
|
||||
--- Iterates over the directory stream `luv_dir_t` returned by a successful
|
||||
--- `uv.fs_opendir()` call. A table of data tables is returned where the number
|
||||
--- of entries `n` is equal to or less than the `entries` parameter used in
|
||||
--- the associated `uv.fs_opendir()` call.
|
||||
---
|
||||
--- **Returns (sync version):** `table` or `fail`
|
||||
--- - `[1, 2, 3, ..., n]` : `table`
|
||||
--- - `name` : `string`
|
||||
--- - `type` : `string`
|
||||
---
|
||||
--- **Returns (async version):** `uv_fs_t userdata`
|
||||
---
|
||||
---@return uv.fs_readdir.entry[]|nil entries
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
---
|
||||
---@overload fun(self:uv.luv_dir_t, callback:uv.fs_readdir.callback):uv.uv_fs_t
|
||||
function dir:readdir() end
|
@ -1,22 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- luv_thread_t
|
||||
---
|
||||
---@class uv.luv_thread_t : userdata
|
||||
local thread = {} -- luacheck: no unused
|
||||
|
||||
--- Returns a boolean indicating whether two threads are the same. This function is
|
||||
--- equivalent to the `__eq` metamethod.
|
||||
---
|
||||
---@param other_thread uv.luv_thread_t
|
||||
---@return boolean
|
||||
function thread:equal(other_thread) end
|
||||
|
||||
--- Waits for the `thread` to finish executing its entry function.
|
||||
---
|
||||
---@return boolean|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function thread:join() end
|
@ -1,19 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- luv_work_ctx_t
|
||||
---
|
||||
---@class uv.luv_work_ctx_t : userdata
|
||||
local work_ctx = {} -- luacheck: no unused
|
||||
|
||||
--- Queues a work request which will run `work_callback` in a new Lua state in a
|
||||
--- thread from the threadpool with any additional arguments from `...`. Values
|
||||
--- returned from `work_callback` are passed to `after_work_callback`, which is
|
||||
--- called in the main loop thread.
|
||||
---
|
||||
---@param ... uv.threadargs
|
||||
---@return boolean|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function work_ctx:queue(...) end
|
@ -1,502 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
---@class uv.getrusage.result.time_t
|
||||
---@field sec integer
|
||||
---@field usec integer
|
||||
|
||||
---@class uv.getrusage.result
|
||||
---
|
||||
---@field utime uv.getrusage.result.time_t # user CPU time used
|
||||
---@field stime uv.getrusage.result.time_t # system CPU time used
|
||||
---@field maxrss integer # maximum resident set size
|
||||
---@field ixrss integer # integral shared memory size
|
||||
---@field idrss integer # integral unshared data size
|
||||
---@field isrss integer # integral unshared stack size
|
||||
---@field minflt integer # page reclaims (soft page faults)
|
||||
---@field majflt integer # page faults (hard page faults)
|
||||
---@field nswap integer # swaps
|
||||
---@field inblock integer # block input operations
|
||||
---@field oublock integer # block output operations
|
||||
---@field msgsnd integer # IPC messages sent
|
||||
---@field msgrcv integer # IPC messages received
|
||||
---@field nsignals integer # signals received
|
||||
---@field nvcsw integer # voluntary context switches
|
||||
---@field nivcsw integer # involuntary context switches
|
||||
|
||||
---@alias uv.spawn.options.stdio.fd integer
|
||||
|
||||
---@alias uv.spawn.options.stdio.stream uv.uv_stream_t
|
||||
|
||||
--- The `options.stdio` entries can take many shapes.
|
||||
---
|
||||
--- - If they are numbers, then the child process inherits that same zero-indexed fd from the parent process.
|
||||
--- - If `uv_stream_t` handles are passed in, those are used as a read-write pipe or inherited stream depending if the stream has a valid fd.
|
||||
--- - Including `nil` placeholders means to ignore that fd in the child process.
|
||||
---
|
||||
---@alias uv.spawn.options.stdio
|
||||
---| integer
|
||||
---| uv.uv_stream_t
|
||||
---| nil
|
||||
|
||||
---@class uv.spawn.options : table
|
||||
---
|
||||
--- Command line arguments as a list of strings. The first string should be the path to the program. On Windows, this uses CreateProcess which concatenates the arguments into a string. This can cause some strange errors. (See `options.verbatim` below for Windows.)
|
||||
---@field args string[]
|
||||
---
|
||||
--- Set environment variables for the new process.
|
||||
---@field env table<string, string>
|
||||
---
|
||||
--- Set the current working directory for the sub-process.
|
||||
---@field cwd string
|
||||
---
|
||||
--- Set the child process' user id.
|
||||
---@field uid string
|
||||
---
|
||||
--- Set the child process' group id.
|
||||
---@field gid string
|
||||
---
|
||||
--- If true, do not wrap any arguments in quotes, or perform any other escaping, when converting the argument list into a command line string. This option is only meaningful on Windows systems. On Unix it is silently ignored.
|
||||
---@field verbatim boolean
|
||||
---
|
||||
--- If true, spawn the child process in a detached state - this will make it a process group leader, and will effectively enable the child to keep running after the parent exits. Note that the child process will still keep the parent's event loop alive unless the parent process calls `uv.unref()` on the child's process handle.
|
||||
---@field detached boolean
|
||||
---
|
||||
--- If true, hide the subprocess console window that would normally be created. This option is only meaningful on Windows systems. On Unix it is silently ignored.
|
||||
---@field hide boolean
|
||||
---
|
||||
--- Set the file descriptors that will be made available to the child process. The convention is that the first entries are stdin, stdout, and stderr. (**Note**: On Windows, file descriptors after the third are available to the child process only if the child processes uses the MSVCRT runtime.)
|
||||
---@field stdio { [1]: uv.spawn.options.stdio, [2]: uv.spawn.options.stdio, [3]: uv.spawn.options.stdio }
|
||||
|
||||
---@class uv.fs_stat.result.time
|
||||
---@field sec integer
|
||||
---@field nsec integer
|
||||
|
||||
---@class uv.fs_stat.result
|
||||
---
|
||||
---@field dev integer
|
||||
---@field mode integer
|
||||
---@field nlink integer
|
||||
---@field uid integer
|
||||
---@field gid integer
|
||||
---@field rdev integer
|
||||
---@field ino integer
|
||||
---@field size integer
|
||||
---@field blksize integer
|
||||
---@field blocks integer
|
||||
---@field flags integer
|
||||
---@field gen integer
|
||||
---@field atime uv.fs_stat.result.time
|
||||
---@field mtime uv.fs_stat.result.time
|
||||
---@field ctime uv.fs_stat.result.time
|
||||
---@field birthtime uv.fs_stat.result.time
|
||||
---@field type string
|
||||
|
||||
---@class uv.fs_statfs.result
|
||||
---
|
||||
---@field type integer
|
||||
---@field bsize integer
|
||||
---@field blocks integer
|
||||
---@field bfree integer
|
||||
---@field bavail integer
|
||||
---@field files integer
|
||||
---@field ffree integer
|
||||
|
||||
---@class uv.getaddrinfo.hints : table
|
||||
---@field family string|integer|uv.socket.family
|
||||
---@field socktype string|integer|uv.socket.type
|
||||
---@field protocol string|integer|uv.socket.protocol
|
||||
---@field addrconfig boolean
|
||||
---@field v4mapped boolean
|
||||
---@field all boolean
|
||||
---@field numerichost boolean
|
||||
---@field passive boolean
|
||||
---@field numericserv boolean
|
||||
---@field canonname boolean
|
||||
|
||||
--- uv.getnameinfo.address
|
||||
---
|
||||
---@class uv.getnameinfo.address : table
|
||||
---@field ip string
|
||||
---@field port integer
|
||||
---@field family string|integer
|
||||
|
||||
--- uv.new_thread.options
|
||||
---
|
||||
---@class uv.new_thread.options : table
|
||||
---@field stack_size integer
|
||||
|
||||
--- uv.pipe.read_flags
|
||||
---
|
||||
---@class uv.pipe.read_flags : table
|
||||
---@field nonblock boolean|false
|
||||
|
||||
--- uv.pipe.write_flags
|
||||
---
|
||||
---@class uv.pipe.write_flags : table
|
||||
---@field nonblock boolean|false
|
||||
|
||||
---@alias uv.socketpair.fds { [1]: integer, [2]: integer }
|
||||
|
||||
--- uv.socketpair.flags
|
||||
---
|
||||
---@class uv.socketpair.flags : table
|
||||
---
|
||||
--- Opens the specified socket handle for `OVERLAPPED` or `FIONBIO`/`O_NONBLOCK` I/O usage. This is recommended for handles that will be used by libuv, and not usually recommended otherwise.
|
||||
---@field nonblock true|false
|
||||
|
||||
---@alias uv.socket.protocol
|
||||
---| string
|
||||
---| "ip"
|
||||
---| "icmp"
|
||||
---| "tcp"
|
||||
---| "udp"
|
||||
|
||||
---@alias uv.socket.type
|
||||
---| "stream"
|
||||
---| "dgram"
|
||||
---| "raw"
|
||||
---| "rdm"
|
||||
---| "seqpacket"
|
||||
|
||||
--- When `protocol` is set to 0 or nil, it will be automatically chosen based on the socket's domain and type.
|
||||
---
|
||||
--- When `protocol` is specified as a string, it will be looked up using the `getprotobyname(3)` function (examples: `"ip"`, `"icmp"`, `"tcp"`, `"udp"`, etc).
|
||||
---
|
||||
---@alias uv.socketpair.protocol
|
||||
---| 0 # automatically choose based on socket domain/type
|
||||
---| nil # automatically choose based on socket domain/type
|
||||
---| uv.socket.protocol
|
||||
|
||||
---@alias uv.socketpair.socktype
|
||||
---| uv.socket.type
|
||||
---| integer
|
||||
---| nil
|
||||
|
||||
--- uv.tcp_bind.flags
|
||||
---
|
||||
---@class uv.tcp_bind.flags : table
|
||||
---@field ipv6only boolean
|
||||
|
||||
--- uv.udp_bind.flags
|
||||
---
|
||||
---
|
||||
---@class uv.udp_bind.flags : table
|
||||
---@field ipv6only boolean
|
||||
---@field reuseaddr boolean
|
||||
|
||||
--- TTY mode is a C enum with the following values:
|
||||
---
|
||||
---@alias uv.tty.mode
|
||||
---| 0 # UV_TTY_MODE_NORMAL: Initial/normal terminal mode
|
||||
---| 1 # UV_TTY_MODE_RAW: Raw input mode (On Windows, ENABLE_WINDOW_INPUT is also enabled)
|
||||
---| 2 # UV_TTY_MODE_IO: Binary-safe I/O mode for IPC (Unix-only)
|
||||
|
||||
--- uv.run() modes:
|
||||
---
|
||||
--- - `"default"`: Runs the event loop until there are no more active and
|
||||
--- referenced handles or requests. Returns `true` if `uv.stop()` was called and
|
||||
--- there are still active handles or requests. Returns `false` in all other
|
||||
--- cases.
|
||||
---
|
||||
--- - `"once"`: Poll for I/O once. Note that this function blocks if there are no
|
||||
--- pending callbacks. Returns `false` when done (no active handles or requests
|
||||
--- left), or `true` if more callbacks are expected (meaning you should run the
|
||||
--- event loop again sometime in the future).
|
||||
---
|
||||
--- - `"nowait"`: Poll for I/O once but don't block if there are no pending
|
||||
--- callbacks. Returns `false` if done (no active handles or requests left),
|
||||
--- or `true` if more callbacks are expected (meaning you should run the event
|
||||
--- loop again sometime in the future).
|
||||
---
|
||||
---@alias uv.run.mode
|
||||
---| "default" # Runs the event loop until there are no more active and referenced handles or requests.
|
||||
---| "once" # Poll for I/O once.
|
||||
---| "nowait" # Poll for I/O once but don't block if there are no pending callbacks.
|
||||
|
||||
---@class uv.interface_addresses.addr
|
||||
---
|
||||
---@field ip string
|
||||
---@field family string
|
||||
---@field netmask string
|
||||
---@field internal boolean
|
||||
---@field mac string
|
||||
|
||||
---@class uv.new_udp.flags
|
||||
---
|
||||
--- When specified, `mmsgs` determines the number of messages able to be received at one time via `recvmmsg(2)` (the allocated buffer will be sized to be able to fit the specified number of max size dgrams). Only has an effect on platforms that support `recvmmsg(2)`.
|
||||
---@field mmsgs integer|nil # default `1`
|
||||
---
|
||||
---@field family uv.new_udp.flags.family|nil
|
||||
|
||||
---@alias uv.new_udp.flags.family uv.socket.family
|
||||
|
||||
---@alias uv.socket.family
|
||||
---| "unix"
|
||||
---| "inet"
|
||||
---| "inet6"
|
||||
---| "ipx"
|
||||
---| "netlink"
|
||||
---| "x25"
|
||||
---| "ax25"
|
||||
---| "atmpvc"
|
||||
---| "appletalk"
|
||||
---| "packet"
|
||||
|
||||
---@class uv.os_get_passwd.info
|
||||
---@field username string
|
||||
---@field uid integer
|
||||
---@field gid integer
|
||||
---@field shell string
|
||||
---@field homedir string
|
||||
|
||||
---@class uv.os_uname.info
|
||||
---@field sysname string
|
||||
---@field release string
|
||||
---@field version string
|
||||
---@field machine string
|
||||
|
||||
---@alias uv.pipe_chmod.flags
|
||||
---| "r"
|
||||
---| "rw"
|
||||
---| "w"
|
||||
---| "wr"
|
||||
|
||||
--- `r` is `READABLE`
|
||||
--- `w` is `WRITABLE`
|
||||
--- `d` is `DISCONNECT`
|
||||
--- `p` is `PRIORITIZED`
|
||||
---
|
||||
---@alias uv.poll.eventspec
|
||||
---| "r"
|
||||
---| "rd"
|
||||
---| "rw"
|
||||
---| "rp"
|
||||
---| "rdp"
|
||||
---| "rwd"
|
||||
---| "rwp"
|
||||
---| "rwdp"
|
||||
---| "d"
|
||||
---| "dp"
|
||||
---| "w"
|
||||
---| "wd"
|
||||
---| "wp"
|
||||
---| "wdp"
|
||||
---| "p"
|
||||
|
||||
--- socket info
|
||||
---
|
||||
---@class uv.socketinfo : table
|
||||
---@field ip string
|
||||
---@field family string|uv.socket.family
|
||||
---@field port integer
|
||||
|
||||
--- uv.udp.sockname
|
||||
---
|
||||
---@alias uv.udp.sockname uv.socketinfo
|
||||
|
||||
---@class uv.uv_fs_t : uv.uv_req_t
|
||||
---@class uv.uv_write_t : uv.uv_req_t
|
||||
---@class uv.uv_connect_t : uv.uv_req_t
|
||||
---@class uv.uv_shutdown_t : uv.uv_req_t
|
||||
---@class uv.uv_udp_send_t : uv.uv_req_t
|
||||
---@class uv.uv_getaddrinfo_t : uv.uv_req_t
|
||||
---@class uv.uv_getnameinfo_t : uv.uv_req_t
|
||||
---@class uv.uv_work_t : uv.uv_req_t
|
||||
|
||||
---@class uv.pipe.fds
|
||||
---@field read integer
|
||||
---@field write integer
|
||||
|
||||
---@class uv.fs_copyfile.flags_t : table
|
||||
---@field excl boolean
|
||||
---@field ficlone boolean
|
||||
---@field ficlone_force boolean
|
||||
|
||||
---@alias uv.fs_copyfile.flags
|
||||
---| uv.fs_copyfile.flags_t
|
||||
---| integer
|
||||
|
||||
---@class uv.fs_event_start.flags : table
|
||||
---@field watch_entry boolean|nil # default: false
|
||||
---@field stat boolean|nil # default: false
|
||||
---@field recursive boolean|nil # default: false
|
||||
|
||||
---@class uv.fs_event_start.callback.events : table
|
||||
---@field change boolean|nil
|
||||
---@field rename boolean|nil
|
||||
|
||||
--- Event loop
|
||||
---
|
||||
--- The event loop is the central part of libuv's functionality. It takes care of
|
||||
--- polling for I/O and scheduling callbacks to be run based on different sources of
|
||||
--- events.
|
||||
---
|
||||
--- In luv, there is an implicit uv loop for every Lua state that loads the library.
|
||||
--- You can use this library in an multi-threaded environment as long as each thread
|
||||
--- has it's own Lua state with its corresponding own uv loop. This loop is not
|
||||
--- directly exposed to users in the Lua module.
|
||||
---
|
||||
---@class uv.uv_loop_t : table
|
||||
|
||||
---@alias uv.threadargs any
|
||||
|
||||
--- Luv APIS that accept a "buffer" type will accept either a string or an array-like table of strings
|
||||
---@alias uv.buffer string|string[]
|
||||
|
||||
---@alias uv.fs_mkdtemp.callback fun(err: uv.callback.err, path?:string)
|
||||
---@alias uv.fs_access.callback fun(err: uv.callback.err, permission?:boolean)
|
||||
---@alias uv.fs_event_start.callback fun(err: uv.callback.err, filename:string, events:uv.fs_event_start.callback.events)
|
||||
---@alias uv.fs_poll_start.callback fun(err: uv.callback.err, prev:uv.fs_stat.result|nil, curr:uv.fs_stat.result|nil)
|
||||
---@alias uv.fs_fstat.callback fun(err: uv.callback.err, stat:uv.fs_stat.result|nil)
|
||||
---@alias uv.fs_lstat.callback fun(err: uv.callback.err, stat:uv.fs_stat.result|nil)
|
||||
---@alias uv.fs_mkstemp.callback fun(err: uv.callback.err, fd?:integer, path?:string)
|
||||
---@alias uv.fs_opendir.callback fun(err: uv.callback.err, dir?:uv.luv_dir_t)
|
||||
---@alias uv.fs_open.callback fun(err: uv.callback.err, fd?:integer)
|
||||
---@alias uv.fs_read.callback fun(err: uv.callback.err, data?:string)
|
||||
---@alias uv.fs_scandir.callback fun(err: uv.callback.err, success?:uv.uv_fs_t)
|
||||
---@alias uv.fs_sendfile.callback fun(err: uv.callback.err, bytes?:integer)
|
||||
---@alias uv.fs_stat.callback fun(err: uv.callback.err, stat: uv.fs_stat.result|nil)
|
||||
---@alias uv.getaddrinfo.callback fun(err: uv.callback.err, addresses:uv.getaddrinfo.result[]|nil)
|
||||
---@alias uv.getnameinfo.callback fun(err: uv.callback.err, host?:string, service?:string)
|
||||
---@alias uv.fs_write.callback fun(err: uv.callback.err, bytes?:integer)
|
||||
---@alias uv.new_async.callback fun(...:uv.threadargs)
|
||||
---@alias uv.new_work.after_work_callback fun(...:uv.threadargs)
|
||||
---@alias uv.new_work.work_callback fun(...:uv.threadargs)
|
||||
---@alias uv.poll_start.callback fun(err: uv.callback.err, events?:string)
|
||||
---@alias uv.random.callback fun(err: uv.callback.err, bytes?:string)
|
||||
---@alias uv.read_start.callback fun(err: uv.callback.err, data?:string)
|
||||
---@alias uv.signal_start.callback fun(signum:string)
|
||||
---@alias uv.signal_start_oneshot.callback fun(signum:string)
|
||||
---@alias uv.spawn.on_exit fun(code:integer, signal:integer)
|
||||
---@alias uv.fs_readlink.callback fun(err: uv.callback.err, path?:string)
|
||||
---@alias uv.fs_realpath.callback fun(err: uv.callback.err, path?:string)
|
||||
---@alias uv.fs_readdir.callback fun(err: uv.callback.err, entries: uv.fs_readdir.entry[]|nil)
|
||||
|
||||
---@class uv.fs_readdir.entry : table
|
||||
---@field name string
|
||||
---@field type string
|
||||
|
||||
---@class uv.udp_recv_start.callback.addr : table
|
||||
---@field ip string
|
||||
---@field port integer
|
||||
---@field family uv.socket.family|string
|
||||
|
||||
---@class uv.udp_recv_start.callback.flags : table
|
||||
---@field partial boolean|nil
|
||||
---@field mmsg_chunk boolean|nil
|
||||
|
||||
---@alias uv.udp_recv_start.callback fun(err:string|nil, data:string|nil, addr:uv.udp_recv_start.callback.addr|nil, flags:uv.udp_recv_start.callback.flags)
|
||||
|
||||
---@alias uv.walk.callback fun(handle:uv.uv_handle_t)
|
||||
|
||||
---@alias uv.fs_statfs.callback fun(err: uv.callback.err, stat: uv.fs_statfs.result|nil)
|
||||
|
||||
---@alias uv.pipe_connect.callback uv.callback
|
||||
---@alias uv.shutdown.callback uv.callback
|
||||
---@alias uv.tcp_connect.callback uv.callback
|
||||
---@alias uv.udp_send.callback uv.callback
|
||||
---@alias uv.write.callback uv.callback
|
||||
---@alias uv.write2.callback uv.callback
|
||||
---@alias uv.listen.callback uv.callback
|
||||
|
||||
---@alias uv.fs_closedir.callback uv.callback_with_success
|
||||
---@alias uv.fs_copyfile.callback uv.callback_with_success
|
||||
---@alias uv.fs_symlink.callback uv.callback_with_success
|
||||
---@alias uv.fs_unlink.callback uv.callback_with_success
|
||||
---@alias uv.fs_utime.callback uv.callback_with_success
|
||||
---@alias uv.fs_chmod.callback uv.callback_with_success
|
||||
---@alias uv.fs_chown.callback uv.callback_with_success
|
||||
---@alias uv.fs_close.callback uv.callback_with_success
|
||||
---@alias uv.fs_fchmod.callback uv.callback_with_success
|
||||
---@alias uv.fs_fchown.callback uv.callback_with_success
|
||||
---@alias uv.fs_fdatasync.callback uv.callback_with_success
|
||||
---@alias uv.fs_fsync.callback uv.callback_with_success
|
||||
---@alias uv.fs_ftruncate.callback uv.callback_with_success
|
||||
---@alias uv.fs_futime.callback uv.callback_with_success
|
||||
---@alias uv.fs_lchown.callback uv.callback_with_success
|
||||
---@alias uv.fs_link.callback uv.callback_with_success
|
||||
---@alias uv.fs_lutime.callback uv.callback_with_success
|
||||
---@alias uv.fs_mkdir.callback uv.callback_with_success
|
||||
---@alias uv.fs_rename.callback uv.callback_with_success
|
||||
---@alias uv.fs_rmdir.callback uv.callback_with_success
|
||||
|
||||
---@class uv.fs_symlink.flags : table
|
||||
---@field dir boolean
|
||||
---@field junction boolean
|
||||
|
||||
---@class uv.getaddrinfo.result : table
|
||||
---
|
||||
---@field addr string
|
||||
---@field family uv.socket.family|string
|
||||
---@field port integer|nil
|
||||
---@field socktype string
|
||||
---@field protocol string
|
||||
---@field canonname string|nil
|
||||
|
||||
---@alias uv.callback.err string|nil
|
||||
|
||||
---@alias uv.callback.success boolean|nil
|
||||
|
||||
---@alias uv.callback fun(err: uv.callback.err)
|
||||
|
||||
---@alias uv.callback_with_success fun(err: uv.callback.err, success: uv.callback.success)
|
||||
|
||||
---@alias uv.fs_open.flags string
|
||||
---| "r"
|
||||
---| "rs"
|
||||
---| "sr"
|
||||
---| "r+"
|
||||
---| "rs+"
|
||||
---| "sr+"
|
||||
---| "w"
|
||||
---| "wx"
|
||||
---| "xw"
|
||||
---| "w+"
|
||||
---| "wx+"
|
||||
---| "xw+"
|
||||
---| "a"
|
||||
---| "ax"
|
||||
---| "xa"
|
||||
---| "a+"
|
||||
---| "ax+"
|
||||
---| "xa+"
|
||||
---| integer
|
||||
|
||||
---@class uv.cpu_info.cpu : table
|
||||
---@field model string
|
||||
---@field speed number
|
||||
---@field times uv.cpu_info.cpu.times
|
||||
|
||||
---@class uv.cpu_info.cpu.times : table
|
||||
---@field user number
|
||||
---@field nice number
|
||||
---@field sys number
|
||||
---@field idle number
|
||||
---@field irq number
|
||||
|
||||
--- The name of the struct for a given request (e.g. `"fs"` for `uv_fs_t`)
|
||||
--- and the libuv enum integer for the request's type (`uv_req_type`).
|
||||
---
|
||||
---@alias uv.req_type.name
|
||||
---| "async"
|
||||
---| "check"
|
||||
---| "fs_event"
|
||||
---| "fs_poll"
|
||||
---| "handle"
|
||||
---| "idle"
|
||||
---| "pipe"
|
||||
---| "poll"
|
||||
---| "prepare"
|
||||
---| "process"
|
||||
---| "req"
|
||||
---| "signal"
|
||||
---| "stream"
|
||||
---| "tcp"
|
||||
---| "timer"
|
||||
---| "tty"
|
||||
---| "udp"
|
||||
|
||||
--- The libuv enum integer for the request's type (`uv_req_type`).
|
||||
---@alias uv.req_type.enum integer
|
File diff suppressed because it is too large
Load Diff
@ -1,37 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Async handles allow the user to "wakeup" the event loop and get a callback
|
||||
--- called from another thread.
|
||||
---
|
||||
--- ```lua
|
||||
--- local async
|
||||
--- async = uv.new_async(function()
|
||||
--- print("async operation ran")
|
||||
--- async:close()
|
||||
--- end)
|
||||
---
|
||||
--- async:send()
|
||||
--- ```
|
||||
---
|
||||
---@class uv.uv_async_t : uv.uv_handle_t
|
||||
---
|
||||
local async = {} -- luacheck: no unused
|
||||
|
||||
--- Wakeup the event loop and call the async handle's callback.
|
||||
---
|
||||
--- **Note**: It's safe to call this function from any thread. The callback will be
|
||||
--- called on the loop thread.
|
||||
---
|
||||
--- **Warning**: libuv will coalesce calls to `uv.async_send(async)`, that is, not
|
||||
--- every call to it will yield an execution of the callback. For example: if
|
||||
--- `uv.async_send()` is called 5 times in a row before the callback is called, the
|
||||
--- callback will only be called once. If `uv.async_send()` is called again after
|
||||
--- the callback was called, it will be called again.
|
||||
---
|
||||
---@param ... uv.threadargs
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function async:send(...) end
|
@ -1,31 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Check handles will run the given callback once per loop iteration, right after
|
||||
--- polling for I/O.
|
||||
---
|
||||
--- ```lua
|
||||
--- local check = uv.new_check()
|
||||
--- check:start(function()
|
||||
--- print("After I/O polling")
|
||||
--- end)
|
||||
--- ```
|
||||
---
|
||||
---@class uv.uv_check_t : uv.uv_handle_t
|
||||
local check = {} -- luacheck: no unused
|
||||
|
||||
--- Start the handle with the given callback.
|
||||
---
|
||||
---@param callback function
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function check:start(callback) end
|
||||
|
||||
--- Stop the handle, the callback will no longer be called.
|
||||
---
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function check:stop() end
|
@ -1,35 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- FS Event handles allow the user to monitor a given path for changes, for
|
||||
--- example, if the file was renamed or there was a generic change in it. This
|
||||
--- handle uses the best backend for the job on each platform.
|
||||
---
|
||||
---@class uv.uv_fs_event_t : uv.uv_handle_t
|
||||
local fs_event = {} -- luacheck: no unused
|
||||
|
||||
--- Get the path being monitored by the handle.
|
||||
---
|
||||
---@return string|nil path
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function fs_event:getpath() end
|
||||
|
||||
--- Start the handle with the given callback, which will watch the specified path
|
||||
--- for changes.
|
||||
---
|
||||
---@param path string
|
||||
---@param flags uv.fs_event_start.flags
|
||||
---@param callback uv.fs_event_start.callback
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function fs_event:start(path, flags, callback) end
|
||||
|
||||
--- Stop the handle, the callback will no longer be called.
|
||||
---
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function fs_event:stop() end
|
@ -1,37 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- FS Poll handles allow the user to monitor a given path for changes. Unlike
|
||||
--- `uv_fs_event_t`, fs poll handles use `stat` to detect when a file has changed so
|
||||
--- they can work on file systems where fs event handles can't.
|
||||
---
|
||||
---@class uv.uv_fs_poll_t : uv.uv_handle_t
|
||||
local fs_poll = {} -- luacheck: no unused
|
||||
|
||||
--- Get the path being monitored by the handle.
|
||||
---
|
||||
---@return string|nil path
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function fs_poll:getpath() end
|
||||
|
||||
--- Check the file at `path` for changes every `interval` milliseconds.
|
||||
---
|
||||
--- **Note:** For maximum portability, use multi-second intervals. Sub-second
|
||||
--- intervals will not detect all changes on many file systems.
|
||||
---
|
||||
---@param path string
|
||||
---@param interval integer
|
||||
---@param callback uv.fs_poll_start.callback
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function fs_poll:start(path, interval, callback) end
|
||||
|
||||
--- Stop the handle, the callback will no longer be called.
|
||||
---
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function fs_poll:stop() end
|
@ -1,132 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Base handle
|
||||
---
|
||||
--- `uv_handle_t` is the base type for all libuv handle types. All API functions
|
||||
--- defined here work with any handle type.
|
||||
---
|
||||
---@class uv.uv_handle_t : table
|
||||
---
|
||||
local handle = {} -- luacheck: no unused
|
||||
|
||||
--- Request handle to be closed.
|
||||
---
|
||||
--- The `callback` will be called asynchronously after this call.
|
||||
---
|
||||
--- This MUST be called on each handle before memory is released.
|
||||
---
|
||||
--- Handles that wrap file descriptors are closed immediately but `callback` will
|
||||
--- still be deferred to the next iteration of the event loop. It gives you a chance
|
||||
--- to free up any resources associated with the handle.
|
||||
---
|
||||
--- In-progress requests, like `uv_connect_t` or `uv_write_t`, are cancelled and
|
||||
--- have their callbacks called asynchronously with `ECANCELED`.
|
||||
---
|
||||
---@param callback? function
|
||||
function handle:close(callback) end
|
||||
|
||||
--- Gets the platform dependent file descriptor equivalent.
|
||||
---
|
||||
--- The following handles are supported: TCP, pipes, TTY, UDP and poll. Calling
|
||||
--- this method on other handle type will fail with `EINVAL`.
|
||||
---
|
||||
--- If a handle doesn't have an attached file descriptor yet or the handle itself
|
||||
--- has been closed, this function will return `EBADF`.
|
||||
---
|
||||
--- **Warning**: Be very careful when using this function. libuv assumes it's in
|
||||
--- control of the file descriptor so any change to it may lead to malfunction.
|
||||
---
|
||||
---@return integer|nil fileno
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function handle:fileno() end
|
||||
|
||||
--- Returns the name of the struct for a given handle (e.g. `"pipe"` for `uv_pipe_t`)
|
||||
--- and the libuv enum integer for the handle's type (`uv_handle_type`).
|
||||
---
|
||||
---@return string type
|
||||
---@return integer enum
|
||||
function handle:get_type() end
|
||||
|
||||
--- Returns `true` if the handle referenced, `false` if not.
|
||||
---
|
||||
---@return boolean|nil has_ref
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function handle:has_ref() end
|
||||
|
||||
--- Returns `true` if the handle is active, `false` if it's inactive.
|
||||
---
|
||||
--- What "active” means depends on the type of handle:
|
||||
---
|
||||
--- - A `uv_async_t` handle is always active and cannot be deactivated, except by closing it with `uv.close()`.
|
||||
---
|
||||
--- - A `uv_pipe_t`, `uv_tcp_t`, `uv_udp_t`, etc. handle - basically any handle that deals with I/O - is active when it is doing something that involves I/O, like reading, writing, connecting, accepting new connections, etc.
|
||||
---
|
||||
--- - A `uv_check_t`, `uv_idle_t`, `uv_timer_t`, etc. handle is active when it has been started with a call to `uv.check_start()`, `uv.idle_start()`, `uv.timer_start()` etc. until it has been stopped with a call to its respective stop function.
|
||||
---
|
||||
---@return boolean|nil active
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function handle:is_active() end
|
||||
|
||||
--- Returns `true` if the handle is closing or closed, `false` otherwise.
|
||||
---
|
||||
--- **Note**: This function should only be used between the initialization of the
|
||||
--- handle and the arrival of the close callback.
|
||||
---
|
||||
---@return boolean|nil closing
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function handle:is_closing() end
|
||||
|
||||
--- Gets or sets the size of the receive buffer that the operating system uses for
|
||||
--- the socket.
|
||||
---
|
||||
--- If `size` is omitted (or `0`), this will return the current send buffer size; otherwise, this will use `size` to set the new send buffer size.
|
||||
---
|
||||
--- This function works for TCP, pipe and UDP handles on Unix and for TCP and UDP
|
||||
--- handles on Windows.
|
||||
---
|
||||
--- **Note**: Linux will set double the size and return double the size of the
|
||||
--- original set value.
|
||||
---
|
||||
---@param size integer
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
---
|
||||
---@overload fun(self):(current_size:integer|nil, err:uv.error.message|nil, err_name:uv.error.name|nil)
|
||||
---@overload fun(self, size: 0):(current_size:integer|nil, err:uv.error.message|nil, err_name:uv.error.name|nil)
|
||||
function handle:recv_buffer_size(size) end
|
||||
|
||||
--- Reference the given handle.
|
||||
---
|
||||
--- References are idempotent, that is, if a handle is already referenced calling this function again will have no effect.
|
||||
function handle:ref() end
|
||||
|
||||
--- Gets or sets the size of the send buffer that the operating system uses for the
|
||||
--- socket.
|
||||
---
|
||||
--- If `size` is omitted (or `0`), this will return the current send buffer size; otherwise, this will use `size` to set the new send buffer size.
|
||||
---
|
||||
--- This function works for TCP, pipe and UDP handles on Unix and for TCP and UDP
|
||||
--- handles on Windows.
|
||||
---
|
||||
--- **Note**: Linux will set double the size and return double the size of the
|
||||
--- original set value.
|
||||
---
|
||||
---@param size integer
|
||||
---@return integer|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
---
|
||||
---@overload fun(self):(current_size:integer|nil, err:uv.error.message|nil, err_name:uv.error.name|nil)
|
||||
---@overload fun(self, size: 0):(current_size:integer|nil, err:uv.error.message|nil, err_name:uv.error.name|nil)
|
||||
function handle:send_buffer_size(size) end
|
||||
|
||||
--- Un-reference the given handle. References are idempotent, that is, if a handle
|
||||
--- is not referenced calling this function again will have no effect.
|
||||
function handle:unref() end
|
@ -1,40 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Idle handles will run the given callback once per loop iteration, right before
|
||||
--- the `uv_prepare_t` handles.
|
||||
---
|
||||
--- **Note**: The notable difference with prepare handles is that when there are
|
||||
--- active idle handles, the loop will perform a zero timeout poll instead of
|
||||
--- blocking for I/O.
|
||||
---
|
||||
--- **Warning**: Despite the name, idle handles will get their callbacks called on
|
||||
--- every loop iteration, not when the loop is actually "idle".
|
||||
---
|
||||
--- ```lua
|
||||
--- local idle = uv.new_idle()
|
||||
--- idle:start(function()
|
||||
--- print("Before I/O polling, no blocking")
|
||||
--- end)
|
||||
--- ```
|
||||
---
|
||||
---@class uv.uv_idle_t : uv.uv_handle_t
|
||||
---
|
||||
local idle = {} -- luacheck: no unused
|
||||
|
||||
--- Start the handle with the given callback.
|
||||
---
|
||||
---@param callback function
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function idle:start(callback) end
|
||||
|
||||
--- Stop the handle, the callback will no longer be called.
|
||||
---
|
||||
---@param check any
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function idle:stop(check) end
|
@ -1,105 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Pipe handles provide an abstraction over local domain sockets on Unix and named pipes on Windows.
|
||||
---
|
||||
--- ```lua
|
||||
--- local pipe = uv.new_pipe(false)
|
||||
---
|
||||
--- pipe:bind('/tmp/sock.test')
|
||||
---
|
||||
--- pipe:listen(128, function()
|
||||
--- local client = uv.new_pipe(false)
|
||||
--- pipe:accept(client)
|
||||
--- client:write("hello!\n")
|
||||
--- client:close()
|
||||
--- end)
|
||||
--- ```
|
||||
---
|
||||
---@class uv.uv_pipe_t : uv.uv_stream_t
|
||||
---
|
||||
local pipe = {} -- luacheck: no unused
|
||||
|
||||
--- Bind the pipe to a file path (Unix) or a name (Windows).
|
||||
---
|
||||
--- **Note**: Paths on Unix get truncated to sizeof(sockaddr_un.sun_path) bytes,
|
||||
--- typically between 92 and 108 bytes.
|
||||
---
|
||||
---@param name string
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function pipe:bind(name) end
|
||||
|
||||
--- Alters pipe permissions, allowing it to be accessed from processes run by different users.
|
||||
---
|
||||
--- Makes the pipe writable or readable by all users. `flags` are: `"r"`, `"w"`, `"rw"`, or `"wr"`
|
||||
--- where `r` is `READABLE` and `w` is `WRITABLE`.
|
||||
---
|
||||
--- This function is blocking.
|
||||
---
|
||||
---@param flags uv.pipe_chmod.flags
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function pipe:chmod(flags) end
|
||||
|
||||
--- Connect to the Unix domain socket or the named pipe.
|
||||
---
|
||||
--- **Note**: Paths on Unix get truncated to sizeof(sockaddr_un.sun_path) bytes,
|
||||
--- typically between 92 and 108 bytes.
|
||||
---
|
||||
---@param name string
|
||||
---@param callback? uv.pipe_connect.callback
|
||||
---@return uv.uv_connect_t|nil conn
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function pipe:connect(name, callback) end
|
||||
|
||||
--- Get the name of the Unix domain socket or the named pipe to which the handle is
|
||||
--- connected.
|
||||
---
|
||||
---@return string|nil peername
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function pipe:getpeername() end
|
||||
|
||||
--- Get the name of the Unix domain socket or the named pipe.
|
||||
---
|
||||
---@return string|nil sockname
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function pipe:getsockname() end
|
||||
|
||||
--- Open an existing file descriptor or `uv_handle_t` as a pipe.
|
||||
---
|
||||
--- **Note**: The file descriptor is set to non-blocking mode.
|
||||
---
|
||||
---@param fd integer
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function pipe:open(fd) end
|
||||
|
||||
--- Returns the pending pipe count for the named pipe.
|
||||
---
|
||||
---@return integer count
|
||||
function pipe:pending_count() end
|
||||
|
||||
--- Set the number of pending pipe instance handles when the pipe server is waiting
|
||||
--- for connections.
|
||||
---
|
||||
--- **Note**: This setting applies to Windows only.
|
||||
---
|
||||
---@param count integer
|
||||
function pipe:pending_instances(count) end
|
||||
|
||||
--- Used to receive handles over IPC pipes.
|
||||
---
|
||||
--- First - call `uv.pipe_pending_count()`, if it's > 0 then initialize a handle of
|
||||
--- the given type, returned by `uv.pipe_pending_type()` and call
|
||||
--- `uv.accept(pipe, handle)`.
|
||||
---
|
||||
---@return string
|
||||
function pipe:pending_type() end
|
@ -1,58 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Poll handles are used to watch file descriptors for readability and writability,
|
||||
--- similar to the purpose of [poll(2)](http://linux.die.net/man/2/poll).
|
||||
---
|
||||
--- The purpose of poll handles is to enable integrating external libraries that
|
||||
--- rely on the event loop to signal it about the socket status changes, like c-ares
|
||||
--- or libssh2. Using `uv_poll_t` for any other purpose is not recommended;
|
||||
--- `uv_tcp_t`, `uv_udp_t`, etc. provide an implementation that is faster and more
|
||||
--- scalable than what can be achieved with `uv_poll_t`, especially on Windows.
|
||||
---
|
||||
--- It is possible that poll handles occasionally signal that a file descriptor is
|
||||
--- readable or writable even when it isn't. The user should therefore always be
|
||||
--- prepared to handle EAGAIN or equivalent when it attempts to read from or write
|
||||
--- to the fd.
|
||||
---
|
||||
--- It is not okay to have multiple active poll handles for the same socket, this
|
||||
--- can cause libuv to busyloop or otherwise malfunction.
|
||||
---
|
||||
--- The user should not close a file descriptor while it is being polled by an
|
||||
--- active poll handle. This can cause the handle to report an error, but it might
|
||||
--- also start polling another socket. However the fd can be safely closed
|
||||
--- immediately after a call to `poll:stop()` or `uv.close()`.
|
||||
---
|
||||
--- **Note**: On windows only sockets can be polled with poll handles. On Unix any
|
||||
--- file descriptor that would be accepted by poll(2) can be used.
|
||||
---
|
||||
---@class uv.uv_poll_t : uv.uv_handle_t
|
||||
local poll = {} -- luacheck: no unused
|
||||
|
||||
--- Starts polling the file descriptor.
|
||||
---
|
||||
--- `events` are: `"r"`, `"w"`, `"rw"`, `"d"`, `"rd"`, `"wd"`, `"rwd"`, `"p"`, `"rp"`, `"wp"`, `"rwp"`, `"dp"`, `"rdp"`, `"wdp"`, or `"rwdp"` where `r` is `READABLE`, `w` is `WRITABLE`, `d` is `DISCONNECT`, and `p` is `PRIORITIZED`.
|
||||
---
|
||||
--- As soon as an event is detected the callback will be called with status set to 0, and the detected events set on the events field.
|
||||
---
|
||||
--- The user should not close the socket while the handle is active. If the user
|
||||
--- does that anyway, the callback may be called reporting an error status, but this
|
||||
--- is not guaranteed.
|
||||
---
|
||||
--- **Note** Calling `poll:start()` on a handle that is already active is fine.
|
||||
--- Doing so will update the events mask that is being watched for.
|
||||
---
|
||||
---@param events uv.poll.eventspec
|
||||
---@param callback uv.poll_start.callback
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function poll:start(events, callback) end
|
||||
|
||||
--- Stop polling the file descriptor, the callback will no longer be called.
|
||||
---
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function poll:stop() end
|
@ -1,32 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Prepare handles will run the given callback once per loop iteration, right
|
||||
--- before polling for I/O.
|
||||
---
|
||||
--- ```lua
|
||||
--- local prepare = uv.new_prepare()
|
||||
--- prepare:start(function()
|
||||
--- print("Before I/O polling")
|
||||
--- end)
|
||||
--- ```
|
||||
---
|
||||
---@class uv.uv_prepare_t : uv.uv_handle_t
|
||||
---
|
||||
local prepare = {} -- luacheck: no unused
|
||||
|
||||
--- Start the handle with the given callback.
|
||||
---
|
||||
---@param callback function
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function prepare:start(callback) end
|
||||
|
||||
--- Stop the handle, the callback will no longer be called.
|
||||
---
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function prepare:stop() end
|
@ -1,24 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Process handles will spawn a new process and allow the user to control it and
|
||||
--- establish communication channels with it using streams.
|
||||
---
|
||||
---@class uv.uv_process_t : uv.uv_handle_t
|
||||
local process = {} -- luacheck: no unused
|
||||
|
||||
--- Returns the handle's pid.
|
||||
---
|
||||
---@return integer pid
|
||||
function process:get_pid() end
|
||||
|
||||
--- Sends the specified signal to the given process handle.
|
||||
---
|
||||
--- Check the documentation on `uv_signal_t` for signal support, specially on Windows.
|
||||
---
|
||||
---@param signum integer|string
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function process:kill(signum) end
|
@ -1,27 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Base request
|
||||
---
|
||||
--- `uv_req_t` is the base type for all libuv request types.
|
||||
---
|
||||
---@class uv.uv_req_t : table
|
||||
---
|
||||
local req = {} -- luacheck: no unused
|
||||
|
||||
--- Cancel a pending request. Fails if the request is executing or has finished
|
||||
--- executing. Only cancellation of `uv_fs_t`, `uv_getaddrinfo_t`,
|
||||
--- `uv_getnameinfo_t` and `uv_work_t` requests is currently supported.
|
||||
---
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function req:cancel() end
|
||||
|
||||
--- Returns the name of the struct for a given request (e.g. `"fs"` for `uv_fs_t`)
|
||||
--- and the libuv enum integer for the request's type (`uv_req_type`).
|
||||
---
|
||||
---@return string type
|
||||
---@return integer enum
|
||||
function req:get_type() end
|
@ -1,70 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Signal handles implement Unix style signal handling on a per-event loop bases.
|
||||
---
|
||||
--- **Unix Notes:**
|
||||
---
|
||||
--- - SIGKILL and SIGSTOP are impossible to catch.
|
||||
---
|
||||
--- - Handling SIGBUS, SIGFPE, SIGILL or SIGSEGV via libuv results into undefined behavior.
|
||||
---
|
||||
--- - SIGABRT will not be caught by libuv if generated by abort(), e.g. through assert().
|
||||
---
|
||||
--- - On Linux SIGRT0 and SIGRT1 (signals 32 and 33) are used by the NPTL pthreads library to manage threads. Installing watchers for those signals will lead to unpredictable behavior and is strongly discouraged. Future versions of libuv may simply reject them.
|
||||
---
|
||||
--- **Windows Notes:**
|
||||
---
|
||||
--- Reception of some signals is emulated on Windows:
|
||||
--- - SIGINT is normally delivered when the user presses CTRL+C. However, like on Unix, it is not generated when terminal raw mode is enabled.
|
||||
---
|
||||
--- - SIGBREAK is delivered when the user pressed CTRL + BREAK.
|
||||
---
|
||||
--- - SIGHUP is generated when the user closes the console window. On SIGHUP the program is given approximately 10 seconds to perform cleanup. After that Windows will unconditionally terminate it.
|
||||
---
|
||||
--- - SIGWINCH is raised whenever libuv detects that the console has been resized. SIGWINCH is emulated by libuv when the program uses a uv_tty_t handle to write to the console. SIGWINCH may not always be delivered in a timely manner; libuv will only detect size changes when the cursor is being moved. When a readable `uv_tty_t` handle is used in raw mode, resizing the console buffer will also trigger a SIGWINCH signal.
|
||||
---
|
||||
--- - Watchers for other signals can be successfully created, but these signals are never received. These signals are: SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGTERM and SIGKILL.
|
||||
---
|
||||
--- - Calls to raise() or abort() to programmatically raise a signal are not detected by libuv; these will not trigger a signal watcher.
|
||||
---
|
||||
---
|
||||
--- ```lua
|
||||
--- -- Create a new signal handler
|
||||
--- local signal = uv.new_signal()
|
||||
--- -- Define a handler function
|
||||
--- uv.signal_start(signal, "sigint", function(signal)
|
||||
--- print("got " .. signal .. ", shutting down")
|
||||
--- os.exit(1)
|
||||
--- end)
|
||||
--- ```
|
||||
---
|
||||
---@class uv.uv_signal_t : uv.uv_handle_t
|
||||
---
|
||||
local signal = {} -- luacheck: no unused
|
||||
|
||||
--- Start the handle with the given callback, watching for the given signal.
|
||||
---
|
||||
---@param signum integer|string
|
||||
---@param callback uv.signal_start.callback
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function signal:start(signum, callback) end
|
||||
|
||||
--- Same functionality as `signal:start()` but the signal handler is reset the moment the signal is received.
|
||||
---
|
||||
---@param signum integer|string
|
||||
---@param callback uv.signal_start_oneshot.callback
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function signal:start_oneshot(signum, callback) end
|
||||
|
||||
--- Stop the handle, the callback will no longer be called.
|
||||
---
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function signal:stop() end
|
@ -1,175 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Stream handles provide an abstraction of a duplex communication channel.
|
||||
--- `uv_stream_t` is an abstract type, libuv provides 3 stream implementations
|
||||
--- in the form of `uv_tcp_t`, `uv_pipe_t` and `uv_tty_t`.
|
||||
---
|
||||
---@class uv.uv_stream_t : uv.uv_handle_t
|
||||
---
|
||||
local stream = {} -- luacheck: no unused
|
||||
|
||||
--- This call is used in conjunction with `uv.listen()` to accept incoming
|
||||
--- connections. Call this function after receiving a callback to accept the
|
||||
--- connection.
|
||||
---
|
||||
--- When the connection callback is called it is guaranteed that this function
|
||||
--- will complete successfully the first time. If you attempt to use it more than
|
||||
--- once, it may fail. It is suggested to only call this function once per
|
||||
--- connection call.
|
||||
---
|
||||
--- ```lua
|
||||
--- server:listen(128, function (err)
|
||||
--- local client = uv.new_tcp()
|
||||
--- server:accept(client)
|
||||
--- end)
|
||||
--- ```
|
||||
---
|
||||
---@param client_stream uv.uv_stream_t
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function stream:accept(client_stream) end
|
||||
|
||||
--- Returns the stream's write queue size.
|
||||
---
|
||||
---@return integer size
|
||||
function stream:get_write_queue_size() end
|
||||
|
||||
--- Returns `true` if the stream is readable, `false` otherwise.
|
||||
---
|
||||
---@return boolean readable
|
||||
function stream:is_readable() end
|
||||
|
||||
--- Returns `true` if the stream is writable, `false` otherwise.
|
||||
---
|
||||
---@return boolean writable
|
||||
function stream:is_writable() end
|
||||
|
||||
--- Start listening for incoming connections.
|
||||
---
|
||||
--- `backlog` indicates the number of connections the kernel might queue, same as `listen(2)`.
|
||||
---
|
||||
--- When a new incoming connection is received the callback is called.
|
||||
---
|
||||
---@param backlog integer
|
||||
---@param callback uv.listen.callback
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function stream:listen(backlog, callback) end
|
||||
|
||||
--- Read data from an incoming stream.
|
||||
---
|
||||
--- The callback will be made several times until there is no more data to read or `stream:read_stop()` is called.
|
||||
---
|
||||
--- When we've reached EOF, `data` will be `nil`.
|
||||
---
|
||||
--- ```lua
|
||||
--- stream:read_start(function (err, chunk)
|
||||
--- if err then
|
||||
--- -- handle read error
|
||||
--- elseif chunk then
|
||||
--- -- handle data
|
||||
--- else
|
||||
--- -- handle disconnect
|
||||
--- end
|
||||
--- end)
|
||||
--- ```
|
||||
---
|
||||
---@param callback uv.read_start.callback
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function stream:read_start(callback) end
|
||||
|
||||
--- Stop reading data from the stream.
|
||||
---
|
||||
--- The read callback will no longer be called.
|
||||
---
|
||||
--- This function is idempotent and may be safely called on a stopped stream.
|
||||
---
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function stream:read_stop() end
|
||||
|
||||
--- Enable or disable blocking mode for a stream.
|
||||
---
|
||||
--- When blocking mode is enabled all writes complete synchronously. The interface
|
||||
--- remains unchanged otherwise, e.g. completion or failure of the operation will
|
||||
--- still be reported through a callback which is made asynchronously.
|
||||
---
|
||||
--- **Warning**: Relying too much on this API is not recommended. It is likely to
|
||||
--- change significantly in the future. Currently this only works on Windows and
|
||||
--- only for `uv_pipe_t` handles. Also libuv currently makes no ordering guarantee
|
||||
--- when the blocking mode is changed after write requests have already been
|
||||
--- submitted. Therefore it is recommended to set the blocking mode immediately
|
||||
--- after opening or creating the stream.
|
||||
---
|
||||
---@param blocking boolean
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function stream:set_blocking(blocking) end
|
||||
|
||||
--- Shutdown the outgoing (write) side of a duplex stream. It waits for pending
|
||||
--- write requests to complete. The callback is called after shutdown is complete.
|
||||
---
|
||||
---@param callback? uv.shutdown.callback
|
||||
---@return uv.uv_shutdown_t|nil shutdown
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function stream:shutdown(callback) end
|
||||
|
||||
--- Same as `stream:write()`, but won't queue a write request if it can't be completed
|
||||
--- immediately.
|
||||
---
|
||||
--- Will return number of bytes written (can be less than the supplied buffer size).
|
||||
---
|
||||
---@param data uv.buffer
|
||||
---@return integer|nil bytes
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function stream:try_write(data) end
|
||||
|
||||
--- Like `stream:write2()`, but with the properties of `stream:try_write()`. Not supported on Windows, where it returns `UV_EAGAIN`.
|
||||
---
|
||||
--- Will return number of bytes written (can be less than the supplied buffer size).
|
||||
---
|
||||
---@param data uv.buffer
|
||||
---@param send_handle uv.uv_stream_t
|
||||
---@return integer|nil bytes
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function stream:try_write2(data, send_handle) end
|
||||
|
||||
--- Write data to stream.
|
||||
---
|
||||
--- `data` can either be a Lua string or a table of strings. If a table is passed
|
||||
--- in, the C backend will use writev to send all strings in a single system call.
|
||||
---
|
||||
--- The optional `callback` is for knowing when the write is complete.
|
||||
---
|
||||
---@param data uv.buffer
|
||||
---@param callback? uv.write.callback
|
||||
---@return uv.uv_write_t|nil bytes
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function stream:write(data, callback) end
|
||||
|
||||
--- Extended write function for sending handles over a pipe. The pipe must be
|
||||
--- initialized with `ipc` option `true`.
|
||||
---
|
||||
--- **Note:** `send_handle` must be a TCP socket or pipe, which is a server or a
|
||||
--- connection (listening or connected state). Bound sockets or pipes will be
|
||||
--- assumed to be servers.
|
||||
---
|
||||
---@param data uv.buffer
|
||||
---@param send_handle uv.uv_stream_t
|
||||
---@param callback? uv.write2.callback
|
||||
---@return uv.uv_write_t|nil write
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function stream:write2(data, send_handle, callback) end
|
@ -1,114 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- TCP handles are used to represent both TCP streams and servers.
|
||||
---
|
||||
---@class uv.uv_tcp_t : uv.uv_stream_t
|
||||
local tcp = {} -- luacheck: no unused
|
||||
|
||||
--- Bind the handle to an host and port.
|
||||
---
|
||||
--- Any `flags` are set with a table with field `ipv6only` equal to `true` or `false`.
|
||||
---
|
||||
--- When the port is already taken, you can expect to see an `EADDRINUSE` error
|
||||
--- from either `tcp:bind()`, `uv.listen()` or `tcp:connect()`. That is, a
|
||||
--- successful call to this function does not guarantee that the call to `uv.listen()`
|
||||
--- or `tcp:connect()` will succeed as well.
|
||||
---
|
||||
--- Use a port of `0` to let the OS assign an ephemeral port. You can look it up
|
||||
--- later using `tcp:getsockname()`.
|
||||
---
|
||||
---@param addr string # must be an IP address and not a hostname
|
||||
---@param port integer # set to `0` to allow the OS to assign an ephemeral port
|
||||
---@param flags? uv.tcp_bind.flags
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function tcp:bind(addr, port, flags) end
|
||||
|
||||
--- Resets a TCP connection by sending a RST packet. This is accomplished by setting
|
||||
--- the SO_LINGER socket option with a linger interval of zero and then calling
|
||||
--- `uv.close()`. Due to some platform inconsistencies, mixing of `uv.shutdown()`
|
||||
--- and `tcp:close_reset()` calls is not allowed.
|
||||
---
|
||||
---@param callback? function
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function tcp:close_reset(callback) end
|
||||
|
||||
--- Establish an IPv4 or IPv6 TCP connection.
|
||||
---
|
||||
--- ```lua
|
||||
--- local client = uv.new_tcp()
|
||||
--- client:connect("127.0.0.1", 8080, function (err)
|
||||
--- -- check error and carry on.
|
||||
--- end)
|
||||
--- ```
|
||||
---
|
||||
---@param host string
|
||||
---@param port integer
|
||||
---@param callback uv.tcp_connect.callback
|
||||
---@return uv.uv_connect_t|nil conn
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function tcp:connect(host, port, callback) end
|
||||
|
||||
--- Get the address of the peer connected to the handle.
|
||||
---
|
||||
---@return uv.socketinfo|nil peername
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function tcp:getpeername() end
|
||||
|
||||
--- Get the current address to which the handle is bound.
|
||||
---
|
||||
---@return uv.socketinfo|nil sockname
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function tcp:getsockname() end
|
||||
|
||||
--- Enable / disable TCP keep-alive.
|
||||
---
|
||||
---@param enable boolean
|
||||
---@param delay? integer # initial delay, in seconds
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function tcp:keepalive(enable, delay) end
|
||||
|
||||
--- Enable / disable Nagle's algorithm.
|
||||
---
|
||||
---@param enable boolean
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function tcp:nodelay(enable) end
|
||||
|
||||
--- Open an existing file descriptor or SOCKET as a TCP handle.
|
||||
---
|
||||
--- **Note:** The passed file descriptor or SOCKET is not checked for its type, but it's required that it represents a valid stream socket.
|
||||
---
|
||||
---@param sock integer
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function tcp:open(sock) end
|
||||
|
||||
--- Enable / disable simultaneous asynchronous accept requests that are queued by
|
||||
--- the operating system when listening for new TCP connections.
|
||||
---
|
||||
--- This setting is used to tune a TCP server for the desired performance. Having
|
||||
--- simultaneous accepts can significantly improve the rate of accepting connections
|
||||
--- (which is why it is enabled by default) but may lead to uneven load distribution
|
||||
--- in multi-process setups.
|
||||
---
|
||||
---@param enable boolean
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function tcp:simultaneous_accepts(enable) end
|
||||
|
||||
--- **Deprecated:** Please use `uv.stream_get_write_queue_size()` instead.
|
||||
function tcp:write_queue_size() end
|
@ -1,57 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Timer handles are used to schedule callbacks to be called in the future.
|
||||
---
|
||||
---@class uv.uv_timer_t : uv.uv_handle_t
|
||||
local timer = {} -- luacheck: no unused
|
||||
|
||||
--- Stop the timer, and if it is repeating restart it using the repeat value as the
|
||||
--- timeout. If the timer has never been started before it raises `EINVAL`.
|
||||
---
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function timer:again() end
|
||||
|
||||
--- Get the timer due value or 0 if it has expired. The time is relative to `uv.now()`.
|
||||
---
|
||||
--- **Note**: New in libuv version 1.40.0.
|
||||
---
|
||||
---@return integer
|
||||
function timer:get_due_in() end
|
||||
|
||||
--- Get the timer repeat value.
|
||||
---
|
||||
---@return integer
|
||||
function timer:get_repeat() end
|
||||
|
||||
--- Set the repeat interval value in milliseconds. The timer will be scheduled to
|
||||
--- run on the given interval, regardless of the callback execution duration, and
|
||||
--- will follow normal timer semantics in the case of a time-slice overrun.
|
||||
---
|
||||
--- For example, if a 50 ms repeating timer first runs for 17 ms, it will be
|
||||
--- scheduled to run again 33 ms later. If other tasks consume more than the 33 ms
|
||||
--- following the first timer callback, then the callback will run as soon as
|
||||
--- possible.
|
||||
---
|
||||
---@param repeat_ integer
|
||||
function timer:set_repeat(repeat_) end
|
||||
|
||||
--- Start the timer. `timeout` and `repeat_` are in milliseconds.
|
||||
---
|
||||
---@param timeout integer # Timeout, in milliseconds. If timeout is zero, the callback fires on the next event loop iteration.
|
||||
---@param repeat_ integer # Repeat interval, in milliseconds. If non-zero, the callback fires after `timeout` milliseconds and then repeatedly after `repeat_` milliseconds.
|
||||
---@param callback function
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function timer:start(timeout, repeat_, callback) end
|
||||
|
||||
--- Stop the timer, the callback will not be called anymore.
|
||||
---
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function timer:stop() end
|
@ -1,46 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- TTY handles represent a stream for the console.
|
||||
---
|
||||
--- ```lua
|
||||
--- -- Simple echo program
|
||||
--- local stdin = uv.new_tty(0, true)
|
||||
--- local stdout = uv.new_tty(1, false)
|
||||
---
|
||||
--- stdin:read_start(function (err, data)
|
||||
--- assert(not err, err)
|
||||
--- if data then
|
||||
--- stdout:write(data)
|
||||
--- else
|
||||
--- stdin:close()
|
||||
--- stdout:close()
|
||||
--- end
|
||||
--- end)
|
||||
--- ```
|
||||
---
|
||||
---@class uv.uv_tty_t : uv.uv_stream_t
|
||||
local tty = {} -- luacheck: no unused
|
||||
|
||||
--- Gets the current Window width and height.
|
||||
---
|
||||
---@return integer|nil width
|
||||
---@return integer|uv.error.message height_or_err
|
||||
---@return uv.error.name|nil err_name
|
||||
function tty:get_winsize() end
|
||||
|
||||
--- Set the TTY using the specified terminal mode.
|
||||
---
|
||||
--- Parameter `mode` is a C enum with the following values:
|
||||
---
|
||||
--- - 0 - UV_TTY_MODE_NORMAL: Initial/normal terminal mode
|
||||
--- - 1 - UV_TTY_MODE_RAW: Raw input mode (On Windows, ENABLE_WINDOW_INPUT is
|
||||
--- also enabled)
|
||||
--- - 2 - UV_TTY_MODE_IO: Binary-safe I/O mode for IPC (Unix-only)
|
||||
---
|
||||
---@param mode uv.tty.mode
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function tty:set_mode(mode) end
|
@ -1,176 +0,0 @@
|
||||
---@meta
|
||||
-- luacheck: no unused args
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- UDP handles encapsulate UDP communication for both clients and servers.
|
||||
---
|
||||
---@class uv.uv_udp_t : uv.uv_handle_t
|
||||
local udp = {} -- luacheck: no unused
|
||||
|
||||
--- Bind the UDP handle to an IP address and port. Any `flags` are set with a table
|
||||
--- with fields `reuseaddr` or `ipv6only` equal to `true` or `false`.
|
||||
---
|
||||
---@param host string
|
||||
---@param port integer
|
||||
---@param flags? uv.udp_bind.flags
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:bind(host, port, flags) end
|
||||
|
||||
--- Associate the UDP handle to a remote address and port, so every message sent by
|
||||
--- this handle is automatically sent to that destination.
|
||||
--
|
||||
--- Calling this function with a NULL addr disconnects the handle. Trying to call `udp:connect()` on an already connected handle will result in an `EISCONN` error. Trying to disconnect a handle that is not connected will return an `ENOTCONN` error.
|
||||
---
|
||||
---@param host string
|
||||
---@param port integer
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:connect(host, port) end
|
||||
|
||||
--- Returns the handle's send queue count.
|
||||
---
|
||||
---@return integer count
|
||||
function udp:get_send_queue_count() end
|
||||
|
||||
--- Returns the handle's send queue size.
|
||||
---
|
||||
---@return integer size
|
||||
function udp:get_send_queue_size() end
|
||||
|
||||
--- Get the remote IP and port of the UDP handle on connected UDP handles.
|
||||
---
|
||||
---@return uv.udp.sockname|nil peername
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:getpeername() end
|
||||
|
||||
--- Get the local IP and port of the UDP handle.
|
||||
---
|
||||
---@return uv.udp.sockname|nil sockname
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:getsockname() end
|
||||
|
||||
--- Opens an existing file descriptor or Windows SOCKET as a UDP handle.
|
||||
---
|
||||
--- Unix only: The only requirement of the sock argument is that it follows the
|
||||
--- datagram contract (works in unconnected mode, supports sendmsg()/recvmsg(),
|
||||
--- etc). In other words, other datagram-type sockets like raw sockets or netlink
|
||||
--- sockets can also be passed to this function.
|
||||
---
|
||||
--- The file descriptor is set to non-blocking mode.
|
||||
---
|
||||
--- Note: The passed file descriptor or SOCKET is not checked for its type, but
|
||||
--- it's required that it represents a valid datagram socket.
|
||||
---
|
||||
---@param fd integer
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:open(fd) end
|
||||
|
||||
--- Prepare for receiving data.
|
||||
---
|
||||
--- If the socket has not previously been bound with `udp:bind()` it is bound to `0.0.0.0` (the "all interfaces" IPv4 address) and a random port number.
|
||||
---
|
||||
---@param callback uv.udp_recv_start.callback
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:recv_start(callback) end
|
||||
|
||||
--- Stop listening for incoming datagrams.
|
||||
---
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:recv_stop() end
|
||||
|
||||
--- Send data over the UDP socket.
|
||||
---
|
||||
--- If the socket has not previously been bound with `udp:bind()` it will be bound to `0.0.0.0` (the "all interfaces" IPv4 address) and a random port number.
|
||||
---
|
||||
---@param data uv.buffer
|
||||
---@param host string
|
||||
---@param port integer
|
||||
---@param callback uv.udp_send.callback
|
||||
---@return uv.uv_udp_send_t|nil bytes
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:send(data, host, port, callback) end
|
||||
|
||||
--- Set broadcast on or off.
|
||||
---
|
||||
---@param on boolean
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:set_broadcast(on) end
|
||||
|
||||
--- Set membership for a multicast address.
|
||||
---
|
||||
---@param multicast_addr string # multicast address to set membership for
|
||||
---@param interface_addr string # interface address
|
||||
---@param membership "leave"|"join" # membership intent
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:set_membership(multicast_addr, interface_addr, membership) end
|
||||
|
||||
--- Set the multicast interface to send or receive data on.
|
||||
---
|
||||
---@param interface_addr string
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:set_multicast_interface(interface_addr) end
|
||||
|
||||
--- Set IP multicast loop flag. Makes multicast packets loop back to local
|
||||
--- sockets.
|
||||
---
|
||||
---@param on boolean
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:set_multicast_loop(on) end
|
||||
|
||||
--- Set the multicast ttl.
|
||||
---
|
||||
---@param ttl integer # an integer 1 through 255
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:set_multicast_ttl(ttl) end
|
||||
|
||||
--- Set membership for a source-specific multicast group.
|
||||
---
|
||||
---@param multicast_addr string # multicast address to set membership for
|
||||
---@param interface_addr? string # interface address
|
||||
---@param source_addr string # source address
|
||||
---@param membership "leave"|"join" # membership intent
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:set_source_membership(multicast_addr, interface_addr, source_addr, membership) end
|
||||
|
||||
--- Set the time to live.
|
||||
---
|
||||
---@param ttl integer # integer 1 through 255
|
||||
---@return 0|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:set_ttl(ttl) end
|
||||
|
||||
--- Same as `udp:send()`, but won't queue a send request if it can't be
|
||||
--- completed immediately.
|
||||
---
|
||||
---@param data uv.buffer
|
||||
---@param host string
|
||||
---@param port integer
|
||||
---@return integer|nil success
|
||||
---@return uv.error.message|nil err
|
||||
---@return uv.error.name|nil err_name
|
||||
function udp:try_send(data, host, port) end
|
@ -136,10 +136,10 @@ function SystemObj:is_closing()
|
||||
return handle == nil or handle:is_closing() or false
|
||||
end
|
||||
|
||||
--- @param output? uv.read_start.callback|false
|
||||
--- @param output? fun(err: string?, data: string?)|false
|
||||
--- @param text? boolean
|
||||
--- @return uv.uv_stream_t? pipe
|
||||
--- @return uv.read_start.callback? handler
|
||||
--- @return fun(err: string?, data: string?)? handler
|
||||
--- @return string[]? data
|
||||
local function setup_output(output, text)
|
||||
if output == false then
|
||||
@ -147,7 +147,7 @@ local function setup_output(output, text)
|
||||
end
|
||||
|
||||
local bucket --- @type string[]?
|
||||
local handler --- @type uv.read_start.callback
|
||||
local handler --- @type fun(err: string?, data: string?)
|
||||
|
||||
if type(output) == 'function' then
|
||||
handler = output
|
||||
@ -167,7 +167,8 @@ local function setup_output(output, text)
|
||||
|
||||
local pipe = assert(uv.new_pipe(false))
|
||||
|
||||
--- @type uv.read_start.callback
|
||||
--- @param err? string
|
||||
--- @param data? string
|
||||
local function handler_with_close(err, data)
|
||||
handler(err, data)
|
||||
if data == nil then
|
||||
|
Reference in New Issue
Block a user