Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exchange Arc<Vec<u8>> for Arc<Cow<'a, [u8]>> #46

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fschutt
Copy link

@fschutt fschutt commented Jan 28, 2021

This way users do not have to allocate the font if the font data is included in the binary. See servo/webrender#4233

Avoids allocation in case the font is embedded in the binary
file as a &'static [u8]
@jdm
Copy link
Member

jdm commented Mar 29, 2021

error[E0308]: mismatched types
  --> src\test.rs:95:53
   |
95 |     let new_font = FontFile::new_from_data(Arc::new(bytes));
   |                                                     ^^^^^ expected enum `Cow`, found struct `Vec`
   |
   = note: expected enum `Cow<'_, [u8]>`
            found struct `Vec<u8>`
error: aborting due to previous error; 2 warnings emitted

Otherwise these changes look fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants