File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
release-content/migration-guides Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 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+ ```
You can’t perform that action at this time.
0 commit comments