mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Use Box<str> instead of Box<String> for UnscannedTextFragmentInfo
This removes an extraneous layer of indirection, without increasing the size of the `SpecificFragmentInfo` enum (because `Box<str>` is a fat pointer, which is the same size as the `FlowRef` trait object that is already stored in `InlineAbsoluteHypotheticalFragmentInfo`)
This commit is contained in:
parent
afe3d7e747
commit
c4dde7297e
3 changed files with 5 additions and 7 deletions
|
@ -705,10 +705,7 @@ pub struct TruncationResult {
|
|||
#[derive(Clone)]
|
||||
pub struct UnscannedTextFragmentInfo {
|
||||
/// The text inside the fragment.
|
||||
///
|
||||
/// FIXME(pcwalton): Is there something more clever we can do here that avoids the double
|
||||
/// indirection while not penalizing all fragments?
|
||||
pub text: Box<String>,
|
||||
pub text: Box<str>,
|
||||
}
|
||||
|
||||
impl UnscannedTextFragmentInfo {
|
||||
|
@ -716,7 +713,7 @@ impl UnscannedTextFragmentInfo {
|
|||
#[inline]
|
||||
pub fn from_text(text: String) -> UnscannedTextFragmentInfo {
|
||||
UnscannedTextFragmentInfo {
|
||||
text: box text,
|
||||
text: text.into_boxed_slice(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue