Build Module type plus engine hooks.
This commit is contained in:
12
src/scope.rs
12
src/scope.rs
@@ -60,7 +60,7 @@ pub struct Entry<'a> {
|
||||
/// allowing for automatic _shadowing_.
|
||||
///
|
||||
/// Currently, `Scope` is neither `Send` nor `Sync`. Turn on the `sync` feature to make it `Send + Sync`.
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Scope<'a>(Vec<Entry<'a>>);
|
||||
|
||||
impl<'a> Scope<'a> {
|
||||
@@ -77,7 +77,7 @@ impl<'a> Scope<'a> {
|
||||
/// assert_eq!(my_scope.get_value::<i64>("x").unwrap(), 42);
|
||||
/// ```
|
||||
pub fn new() -> Self {
|
||||
Self(Vec::new())
|
||||
Default::default()
|
||||
}
|
||||
|
||||
/// Empty the Scope.
|
||||
@@ -177,7 +177,7 @@ impl<'a> Scope<'a> {
|
||||
name,
|
||||
EntryType::Module,
|
||||
Dynamic(Union::Module(Box::new(value))),
|
||||
true,
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -422,12 +422,6 @@ impl<'a> Scope<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Scope<'_> {
|
||||
fn default() -> Self {
|
||||
Scope::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, K: Into<Cow<'a, str>>> iter::Extend<(K, EntryType, Dynamic)> for Scope<'a> {
|
||||
fn extend<T: IntoIterator<Item = (K, EntryType, Dynamic)>>(&mut self, iter: T) {
|
||||
self.0
|
||||
|
Reference in New Issue
Block a user