-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(turbo-tasks): Remove public OperationVc constructor, introdu…
…ce a macro annotation for creating OperationVc types
- Loading branch information
Showing
8 changed files
with
174 additions
and
22 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
turbopack/crates/turbo-tasks-macros-tests/tests/function/fail_attribute_invalid_args.stderr
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
.../turbo-tasks-macros-tests/tests/function/fail_attribute_invalid_args_inherent_impl.stderr
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
turbopack/crates/turbo-tasks-macros-tests/tests/function/fail_operation_vc_arg.rs
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,13 @@ | ||
#![allow(dead_code)] | ||
|
||
use anyhow::Result; | ||
use turbo_tasks::{ResolvedVc, Vc}; | ||
|
||
#[turbo_tasks::function(operation)] | ||
async fn multiply(value: Vc<i32>, coefficient: ResolvedVc<i32>) -> Result<Vc<i32>> { | ||
let value = *value.await?; | ||
let coefficient = *coefficient.await?; | ||
Ok(Vc::cell(value * coefficient)) | ||
} | ||
|
||
fn main() {} |
43 changes: 43 additions & 0 deletions
43
turbopack/crates/turbo-tasks-macros-tests/tests/function/fail_operation_vc_arg.stderr
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
turbopack/crates/turbo-tasks-macros-tests/tests/function/pass_operation.rs
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,20 @@ | ||
use anyhow::Result; | ||
use turbo_tasks::{OperationVc, Vc}; | ||
|
||
#[turbo_tasks::function(operation)] | ||
fn bare_op_fn() -> Vc<i32> { | ||
Vc::cell(21) | ||
} | ||
|
||
#[turbo_tasks::function(operation)] | ||
async fn multiply(value: OperationVc<i32>, coefficient: i32) -> Result<Vc<i32>> { | ||
Ok(Vc::cell(*value.connect().await? * coefficient)) | ||
} | ||
|
||
#[allow(dead_code)] | ||
fn use_operations() { | ||
let twenty_one: OperationVc<i32> = bare_op_fn(); | ||
let _fourty_two: OperationVc<i32> = multiply(twenty_one, 2); | ||
} | ||
|
||
fn main() {} |
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