Add stab tag for async functions
This commit is contained in:
@@ -27,7 +27,7 @@ pub enum Error {
|
||||
/// IP or socket address syntax error.
|
||||
#[error("{0}")]
|
||||
InvalidAddr(#[from] AddrParseError),
|
||||
/// Socket was already converted and cannot be used.
|
||||
/// Socket was already converted and cannot be used anymore.
|
||||
#[error("socket was already converted")]
|
||||
SocketConsumed,
|
||||
}
|
||||
@@ -141,7 +141,7 @@ impl lb_netlib {
|
||||
Ok(Some(TcpSocket::new_v6()?).into())
|
||||
}
|
||||
|
||||
pub extern "Lua" fn bind_tcp(&self, addr: any, port: any) -> Result<lb_tcpsocket> {
|
||||
pub async extern "Lua" fn bind_tcp(&self, addr: any, port: any) -> Result<lb_tcpsocket> {
|
||||
let addr = self.socketaddr(addr, port);
|
||||
let socket;
|
||||
if addr.ip().is_v6() {
|
||||
@@ -153,7 +153,7 @@ impl lb_netlib {
|
||||
socket
|
||||
}
|
||||
|
||||
pub extern "Lua" fn connect_tcp(&self, addr: any, port: any) -> Result<lb_tcpstream> {
|
||||
pub async extern "Lua" fn connect_tcp(&self, addr: any, port: any) -> Result<lb_tcpstream> {
|
||||
let addr = self.socketaddr(addr, port);
|
||||
let socket;
|
||||
if addr.ip().is_v6() {
|
||||
@@ -164,7 +164,7 @@ impl lb_netlib {
|
||||
socket.connect(addr)
|
||||
}
|
||||
|
||||
pub extern "Lua" fn listen_tcp(&self, addr: any, port: any) -> Result<lb_tcplistener> {
|
||||
pub async extern "Lua" fn listen_tcp(&self, addr: any, port: any) -> Result<lb_tcplistener> {
|
||||
self.bind_tcp(addr, port).listen(1024)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ impl lb_tasklib {
|
||||
sleep(Duration::from_secs_f64(ms / 1000.)).await;
|
||||
}
|
||||
|
||||
pub extern "Lua" fn spawn(&self, f: function, ...) {
|
||||
pub extern "Lua" fn spawn(&self, f: function, ...) -> lb_task {
|
||||
// pack the function and its arguments into a table and pass its ref to rust.
|
||||
//
|
||||
// this table is used from rust-side to call the function with its args, and it's also
|
||||
@@ -82,7 +82,7 @@ pub struct lb_task {
|
||||
|
||||
#[metatype]
|
||||
impl lb_task {
|
||||
pub extern "Lua" fn r#await(&self) -> many {
|
||||
pub async extern "Lua" fn r#await(&self) -> many {
|
||||
self.__await();
|
||||
let ret = __registry[self.__ref];
|
||||
__tunpack(ret, 1, ret.n)
|
||||
|
||||
Reference in New Issue
Block a user