mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
fix(unstable): support importing files in npm packages as bytes and text (#30065)
This commit is contained in:
parent
a046f2c1bf
commit
cf441584a4
19 changed files with 545 additions and 349 deletions
|
@ -7,6 +7,7 @@ pub fn is_valid_utf8(bytes: &[u8]) -> bool {
|
|||
matches!(String::from_utf8_lossy(bytes), Cow::Borrowed(_))
|
||||
}
|
||||
|
||||
// todo(https://github.com/rust-lang/rust/issues/129436): remove once stabilized
|
||||
#[inline(always)]
|
||||
pub fn from_utf8_lossy_owned(bytes: Vec<u8>) -> String {
|
||||
match String::from_utf8_lossy(&bytes) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue