diff --git a/crates/lb/src/fs.rs b/crates/lb/src/fs.rs index 8e5f224..8cffd32 100644 --- a/crates/lb/src/fs.rs +++ b/crates/lb/src/fs.rs @@ -1,15 +1,15 @@ -//! The `lb:fs` module provides utilities for interacting with the file system asynchronously. +//! The `lb:fs` library provides utilities for interacting with the file system asynchronously. //! //! # Exports //! -//! See [`lb_libfs`] for items exported by this module. +//! See [`lb_libfs`] for items exported by this library. use luaffi::{cdef, metatype}; use std::io; use tokio::fs; -/// Items exported by the `lb:fs` module. +/// Items exported by the `lb:fs` library. /// -/// This module can be obtained by calling `require` in Lua. +/// This library can be obtained by calling `require` in Lua. /// /// ```lua /// local fs = require("lb:fs"); diff --git a/crates/lb/src/net.rs b/crates/lb/src/net.rs index e159e52..27594ac 100644 --- a/crates/lb/src/net.rs +++ b/crates/lb/src/net.rs @@ -1,9 +1,9 @@ -//! The `lb:net` module provides an asynchronous network API for creating TCP or UDP servers and +//! The `lb:net` library provides an asynchronous network API for creating TCP or UDP servers and //! clients. //! //! # Exports //! -//! See [`lb_libnet`] for items exported by this module. +//! See [`lb_libnet`] for items exported by this library. use derive_more::{From, FromStr}; use luaffi::{cdef, metatype}; use std::{ @@ -12,9 +12,9 @@ use std::{ }; use tokio::net::{TcpListener, TcpSocket, TcpStream}; -/// Items exported by the `lb:net` module. +/// Items exported by the `lb:net` library. /// -/// This module can be obtained by calling `require` in Lua. +/// This library can be obtained by calling `require` in Lua. /// /// ```lua /// local net = require("lb:net"); diff --git a/crates/lb/src/runtime.rs b/crates/lb/src/runtime.rs index 84a2757..e4708c2 100644 --- a/crates/lb/src/runtime.rs +++ b/crates/lb/src/runtime.rs @@ -41,6 +41,7 @@ impl Builder { let mut s = State::new()?; let mut chunk = Chunk::new(self.registry.done()); chunk.extend(include_bytes!("./runtime.lua")); + // println!("{chunk}"); s.eval(chunk.path("[luby]"), 0, 0)?; s }, diff --git a/test.lua b/test.lua index de9e518..72ad083 100644 --- a/test.lua +++ b/test.lua @@ -1,6 +1,19 @@ -local ffi = require("ffi") -local lb = ffi.new("struct lb_core") +local fs = require("lb:fs") -print(lb) +-- do +-- local start = os.clock() +-- for i = 1, 50000 do +-- fs:read("crates/luaffi_impl/src/metatype.rs") +-- end +-- local finish = os.clock() +-- print("finish in " .. (finish - start)) +-- end -lb.spawn("") +do + local start = os.clock() + for i = 1, 30000 do + fs:read_sync("bacon.toml") + end + local finish = os.clock() + print("finish in " .. (finish - start)) +end