pub unsafe trait Intern:
Hash
+ PartialEq
+ Eq {
type Primitive: Sized + Copy + Debug;
// Required methods
fn as_bytes(&self) -> &[Self::Primitive];
unsafe fn from_bytes(bytes: &[Self::Primitive]) -> &Self;
}Expand description
Trait implemented by different types of strings that can be interned.
§Safety
It should be alwas valid to reinterpret bytes of Self as &[Self::Primitive]
using Intern::as_bytes.
It should be valid to reinterpret bytes copied from Intern::as_bytes.
as &Self using Intern::from_bytes. Even if they were moved in memory.
Required Associated Types§
Required Methods§
fn as_bytes(&self) -> &[Self::Primitive]
Sourceunsafe fn from_bytes(bytes: &[Self::Primitive]) -> &Self
unsafe fn from_bytes(bytes: &[Self::Primitive]) -> &Self
§Safety
See Safety section in the trait doc.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".