Skip to content

Commit

Permalink
Change return type of greet handlers Rust templates (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
gvdongen authored Nov 22, 2024
1 parent d5bb855 commit 9a9c7cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions templates/rust-shuttle/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ use std::time::Duration;

#[restate_sdk::service]
trait Greeter {
async fn greet(name: String) -> HandlerResult<String>;
async fn greet(name: String) -> Result<String, HandlerError>;
}

struct GreeterImpl;

impl Greeter for GreeterImpl {
async fn greet(&self, mut ctx: Context<'_>, name: String) -> HandlerResult<String> {
async fn greet(&self, mut ctx: Context<'_>, name: String) -> Result<String, HandlerError> {
// Durably execute a set of steps; resilient against failures
let greeting_id = ctx.rand_uuid().to_string();
ctx.run(|| send_notification(&greeting_id, &name)).await?;
Expand Down
4 changes: 2 additions & 2 deletions templates/rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use utils::{send_notification, send_reminder};

#[restate_sdk::service]
trait Greeter {
async fn greet(name: String) -> HandlerResult<String>;
async fn greet(name: String) -> Result<String, HandlerError>;
}

struct GreeterImpl;

impl Greeter for GreeterImpl {
async fn greet(&self, mut ctx: Context<'_>, name: String) -> HandlerResult<String> {
async fn greet(&self, mut ctx: Context<'_>, name: String) -> Result<String, HandlerError> {
// Durably execute a set of steps; resilient against failures
let greeting_id = ctx.rand_uuid().to_string();
ctx.run(|| send_notification(&greeting_id, &name)).await?;
Expand Down

0 comments on commit 9a9c7cf

Please sign in to comment.