Skip to content

Commit abc6390

Browse files
committed
Create a migration guide for changes to ProcessContext.
1 parent d3da3be commit abc6390

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Changes to the `Process` trait.
3+
pull_requests: []
4+
---
5+
6+
`ProcessContext` no longer includes `asset_bytes`. This has been replaced by `asset_reader`. To
7+
maintain current behavior in a `Process` implementation, you can read all the bytes into memory.
8+
If previously, you did:
9+
10+
```rust
11+
// Inside `impl Process for Type`
12+
let bytes = context.asset_bytes();
13+
// Use bytes here!
14+
```
15+
16+
Then now, it should be:
17+
18+
```rust
19+
// Inside `impl Process for Type`
20+
let reader = context.asset_reader();
21+
let mut bytes = vec![];
22+
reader
23+
.read_to_end(&mut bytes)
24+
.await
25+
.map_err(|err| ProcessError::AssetReaderError {
26+
path: context.path().clone_owned(),
27+
err: err.into(),
28+
})?;
29+
// Use bytes here!
30+
```

0 commit comments

Comments
 (0)