Wrap metadata elements in Cow (#2364)
* feat: Wrap metadata elements in Cow * fix(libafl_bolts): Compile Error due to wrong type * cleanup(libafl_bolts): Remove unnecessary import * cleanup(libafl_bolts): Removed unnecessary alloc * fix(libafl_bolts): Fixed type_repr_owned * cleanup(libafl_bolts): unused import
This commit is contained in:
parent
2356ba5754
commit
571c4c111e
@ -1,8 +1,8 @@
|
||||
//! Poor-rust-man's downcasts for stuff we send over the wire (or shared maps)
|
||||
|
||||
use alloc::boxed::Box;
|
||||
#[cfg(feature = "stable_anymap")]
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::borrow::Cow;
|
||||
use alloc::boxed::Box;
|
||||
#[cfg(feature = "stable_anymap")]
|
||||
use core::any::type_name;
|
||||
#[cfg(not(feature = "stable_anymap"))]
|
||||
@ -21,7 +21,7 @@ pub type TypeRepr = u128;
|
||||
|
||||
/// The type of a stored type in this anymap (`String`)
|
||||
#[cfg(feature = "stable_anymap")]
|
||||
pub type TypeRepr = String;
|
||||
pub type TypeRepr = Cow<'static, str>;
|
||||
|
||||
#[cfg(not(feature = "stable_anymap"))]
|
||||
fn type_repr<T>() -> TypeRepr
|
||||
@ -41,7 +41,7 @@ where
|
||||
|
||||
#[cfg(feature = "stable_anymap")]
|
||||
fn type_repr_owned<T>() -> TypeRepr {
|
||||
type_name::<T>().to_string()
|
||||
Cow::Borrowed(type_name::<T>())
|
||||
}
|
||||
|
||||
#[cfg(feature = "stable_anymap")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user