mirror of
https://github.com/RGBCube/embd-rs
synced 2025-07-27 05:27:44 +00:00
Make bytes actually bytes
This commit is contained in:
parent
e77562e096
commit
2dd76f6494
2 changed files with 3 additions and 3 deletions
|
@ -9,8 +9,8 @@ On release mode it falls back to `include_str!`, `include_bytes!` and `include_d
|
|||
## Usage
|
||||
|
||||
```rs
|
||||
let contents: String = embed::string!("path/to/file.txt");
|
||||
let bytes: Vec<u8> = embed::bytes!("path/to/image.png");
|
||||
let contents: Cow<'_, str> = embed::string!("path/to/file.txt");
|
||||
let bytes: Cow<'_, [u8]> = embed::bytes!("path/to/image.png");
|
||||
```
|
||||
|
||||
## License
|
||||
|
|
|
@ -46,7 +46,7 @@ macro_rules! bytes {
|
|||
.expect("embed: file has no parent")
|
||||
.join($path);
|
||||
|
||||
Cow::<'static, str>::Owned(fs::read_to_string(&file).unwrap_or_else(|error| {
|
||||
Cow::<'static, [u8]>::Owned(fs::read(&file).unwrap_or_else(|error| {
|
||||
panic!(
|
||||
"embed: failed to read file {file}: {error}",
|
||||
file = file.display()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue