Skip to content
Discussion options

You must be logged in to vote

as server function return Result<> and <Await/> future= doesn't like that sort of function.

I'm not sure what you mean. Here's an example I just stuck into one of the todo_app_sqlite examples.

<Await
    future=get_todos()
    let:data
>
    <pre>
        {match data {
            Ok(todos) => format!("{todos:#?}"),
            Err(e) => e.to_string()
        }}
    </pre>
</Await>

Works completely fine.

What have you tried and what hasn't worked? (Note that it gives you &T, not T, but things being rendered need to be owned -- so for example if you just map over the result you need to clone the error, so that it ends up as Result<T, ServerFnError> and not Result<T, &ServerFnError>.)

An…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by rgr-1
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants