How do you define an op in rust to return a string?
fails to compile
https://github.com/denoland/deno_core/blob/main/ops/op2/README.md#return-values this guide says I should mark string with
#[string] String, however this also doesn't compile.#[deno_core::op2(async)]
async fn op_fetch(#[string] req: String) -> String {
async { "hello".to_string() }.await
}70 | #[deno_core::op2(async)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: message: Failed to parse #[op2]:
- Failed to parse signature
- Invalid return type
- Invalid return type
- Missing a #[string] attribute for type: String#[string] String#[deno_core::op2(async)]
async fn op_fetch(#[string] req: String) -> #[string] String {
async { "hello".to_string() }.await
}71 | async fn op_fetch2(#[string] req: String) -> #[string] String {
| ^ expected type