Call it library not module
This commit is contained in:
parent
a81271c0a8
commit
530a1530ba
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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
|
||||
},
|
||||
|
21
test.lua
21
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user