Fix merging strings interner.
This commit is contained in:
parent
4bd482352e
commit
3488dbe74b
@ -8,8 +8,9 @@ use std::prelude::v1::*;
|
|||||||
/// _(internals)_ A factory of identifiers from text strings.
|
/// _(internals)_ A factory of identifiers from text strings.
|
||||||
/// Exported under the `internals` feature only.
|
/// Exported under the `internals` feature only.
|
||||||
///
|
///
|
||||||
/// Since [`SmartString`](https://crates.io/crates/smartstring) is used as [`Identifier`],
|
/// Normal identifiers are not interned since [`SmartString`][crate::SmartString] and thus copying
|
||||||
/// this just returns a copy because most identifiers in Rhai are short and ASCII-based.
|
/// is relatively fast , this just returns a copy
|
||||||
|
/// because most identifiers in Rhai are short and ASCII-based.
|
||||||
///
|
///
|
||||||
/// Property getters and setters are interned separately.
|
/// Property getters and setters are interned separately.
|
||||||
#[derive(Debug, Clone, Default, Hash)]
|
#[derive(Debug, Clone, Default, Hash)]
|
||||||
@ -71,12 +72,9 @@ impl StringsInterner {
|
|||||||
_ => unreachable!("unsupported prefix {}", prefix),
|
_ => unreachable!("unsupported prefix {}", prefix),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Merge another [`IdentifierBuilder`] into this.
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn merge(&mut self, _other: &Self) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AddAssign for StringsInterner {
|
impl AddAssign<Self> for StringsInterner {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn add_assign(&mut self, rhs: Self) {
|
fn add_assign(&mut self, rhs: Self) {
|
||||||
let _rhs = rhs;
|
let _rhs = rhs;
|
||||||
@ -88,3 +86,18 @@ impl AddAssign for StringsInterner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AddAssign<&Self> for StringsInterner {
|
||||||
|
#[inline(always)]
|
||||||
|
fn add_assign(&mut self, rhs: &Self) {
|
||||||
|
let _rhs = rhs;
|
||||||
|
|
||||||
|
#[cfg(not(feature = "no_object"))]
|
||||||
|
{
|
||||||
|
self.getters
|
||||||
|
.extend(_rhs.getters.iter().map(|(k, v)| (k.clone(), v.clone())));
|
||||||
|
self.setters
|
||||||
|
.extend(_rhs.setters.iter().map(|(k, v)| (k.clone(), v.clone())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user