-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3426 from wasmerio/wasix-core-changes
WASIX Preparation All changes for WASIX that affect the main crates.
- Loading branch information
Showing
85 changed files
with
1,534 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
use bytes::Bytes; | ||
use std::borrow::Cow; | ||
|
||
/// Convert binary data into [`bytes::Bytes`]. | ||
pub trait IntoBytes { | ||
/// Convert binary data into [`bytes::Bytes`]. | ||
fn into_bytes(self) -> Bytes; | ||
} | ||
|
||
impl IntoBytes for Bytes { | ||
fn into_bytes(self) -> Bytes { | ||
self | ||
} | ||
} | ||
|
||
impl IntoBytes for Vec<u8> { | ||
fn into_bytes(self) -> Bytes { | ||
Bytes::from(self) | ||
} | ||
} | ||
|
||
impl IntoBytes for &Vec<u8> { | ||
fn into_bytes(self) -> Bytes { | ||
Bytes::from(self.clone()) | ||
} | ||
} | ||
|
||
impl IntoBytes for &[u8] { | ||
fn into_bytes(self) -> Bytes { | ||
Bytes::from(self.to_vec()) | ||
} | ||
} | ||
|
||
impl<const N: usize> IntoBytes for &[u8; N] { | ||
fn into_bytes(self) -> Bytes { | ||
Bytes::from(self.to_vec()) | ||
} | ||
} | ||
|
||
impl IntoBytes for &str { | ||
fn into_bytes(self) -> Bytes { | ||
Bytes::from(self.as_bytes().to_vec()) | ||
} | ||
} | ||
|
||
impl IntoBytes for Cow<'_, [u8]> { | ||
fn into_bytes(self) -> Bytes { | ||
Bytes::from(self.to_vec()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.