re-fmt comments

This commit is contained in:
Andy Weidenbaum 2021-02-17 22:34:46 +11:00
parent 8c8bd29d0d
commit a331b2bf8b

View File

@ -3,17 +3,14 @@ use std::collections::HashMap;
use crate::types::Result;
/// Stores Lua modules indexed by module name, and provides an
/// `rlua::MetaMethod` to enable `require`ing the stored modules by name
/// in an `rlua::Context`.
/// Stores Lua modules indexed by module name, and provides an `rlua::MetaMethod`
/// to enable `require`ing the stored modules by name in an `rlua::Context`.
struct Searcher {
/// A `HashMap` of Lua modules in `String` representation, indexed
/// by module name.
/// A `HashMap` of Lua modules in `String` representation, indexed by module name.
modules: HashMap<String, String>,
/// An `rlua::RegistryKey` whose value is the Lua environment within
/// which the user made the request to instantiate a `Searcher` for
/// `modules`.
/// An `rlua::RegistryKey` whose value is the Lua environment within which the
/// user made the request to instantiate a `Searcher` for `modules`.
globals: RegistryKey,
}
@ -40,8 +37,8 @@ impl UserData for Searcher {
}
}
/// Like `Searcher`, but with `modules` values encoded as `&'static str`
/// to facilitate compile-time includes of Fennel source code.
/// Like `Searcher`, but with `modules` values encoded as `&'static str` to facilitate
/// compile-time includes of Fennel source code.
struct StaticSearcher {
modules: HashMap<&'static str, &'static str>,
globals: RegistryKey,
@ -73,12 +70,12 @@ impl UserData for StaticSearcher {
/// Extend `rlua::Context` to support `require`ing Lua modules by name.
pub trait AddSearcher {
/// Add a `HashMap` of Lua modules indexed by module name to Luas
/// `package.searchers` table in an `rlua::Context`, with lookup
/// functionality provided by the `rlua_searcher::Searcher` struct.
/// `package.searchers` table in an `rlua::Context`, with lookup functionality
/// provided by the `rlua_searcher::Searcher` struct.
fn add_searcher(&self, modules: HashMap<String, String>) -> Result<()>;
/// Like `add_searcher`, but with Fennel source code encoded as
/// `&'static str` to facilitate compile-time includes.
/// Like `add_searcher`, but with Fennel source code encoded as `&'static str`
/// to facilitate compile-time includes.
fn add_static_searcher(&self, modules: HashMap<&'static str, &'static str>) -> Result<()>;
}