Use Box<str> internally.

This commit is contained in:
Stephen Chung
2021-11-11 13:55:52 +08:00
parent 6b27ca19d5
commit 0fbc437916
9 changed files with 121 additions and 97 deletions

View File

@@ -77,7 +77,7 @@ pub struct ScriptFnDef {
/// Not available under `no_function`.
#[cfg(not(feature = "no_function"))]
#[cfg(feature = "metadata")]
pub comments: StaticVec<String>,
pub comments: StaticVec<Box<str>>,
}
impl fmt::Display for ScriptFnDef {
@@ -156,7 +156,7 @@ impl<'a> From<&'a ScriptFnDef> for ScriptFnMetadata<'a> {
Self {
#[cfg(not(feature = "no_function"))]
#[cfg(feature = "metadata")]
comments: value.comments.iter().map(|s| s.as_str()).collect(),
comments: value.comments.iter().map(Box::as_ref).collect(),
access: value.access,
name: &value.name,
params: value.params.iter().map(|s| s.as_str()).collect(),