Skip to content

Commit d8a9aec

Browse files
committed
fix issues
1 parent 863ff3e commit d8a9aec

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

examples/services/my_workflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub trait MyWorkflow {
1010
pub struct MyWorkflowImpl;
1111

1212
impl MyWorkflow for MyWorkflowImpl {
13-
async fn run(&self, ctx: WorkflowContext<'_>, req: String) -> Result<String, HandlerError> {
13+
async fn run(&self, _ctx: WorkflowContext<'_>, _req: String) -> Result<String, HandlerError> {
1414
// implement workflow logic here
1515

1616
Ok(String::from("success"))

src/context/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use std::time::Duration;
88

99
mod request;
1010
mod run;
11-
1211
pub use request::{Request, RequestTarget};
1312
pub use run::{RunClosure, RunFuture, RunRetryPolicy};
1413

@@ -268,7 +267,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextTimers<'ctx> for CTX {}
268267
/// You can do request-response calls to Services, Virtual Objects, and Workflows, in the following way:
269268
///
270269
/// ```
271-
/// # #[path = "../examples/services"]
270+
/// # #[path = "../../examples/services"]
272271
/// # mod services;
273272
/// # use services::my_service::MyServiceClient;
274273
/// # use services::my_virtual_object::MyVirtualObjectClient;
@@ -331,7 +330,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextTimers<'ctx> for CTX {}
331330
/// Handlers can send messages (a.k.a. one-way calls, or fire-and-forget calls), as follows:
332331
///
333332
/// ```
334-
/// # #[path = "../examples/services"]
333+
/// # #[path = "../../examples/services"]
335334
/// # mod services;
336335
/// # use services::my_service::MyServiceClient;
337336
/// # use services::my_virtual_object::MyVirtualObjectClient;
@@ -411,7 +410,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextTimers<'ctx> for CTX {}
411410
/// For example, assume a handler calls the same Virtual Object twice:
412411
///
413412
/// ```
414-
/// # #[path = "../examples/services"]
413+
/// # #[path = "../../examples/services"]
415414
/// # mod services;
416415
/// # use services::my_virtual_object::MyVirtualObjectClient;
417416
/// # use restate_sdk::prelude::*;
@@ -577,7 +576,9 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextClient<'ctx> for CTX {}
577576
/// /// 3. Wait for the promise to be resolved
578577
/// let payload = promise.await?;
579578
/// # }
580-
/// # fn trigger_task_and_deliver_id(awakeable_id: String){}
579+
/// # async fn trigger_task_and_deliver_id(awakeable_id: String) -> Result<(), HandlerError>{
580+
/// # Ok(())
581+
/// # }
581582
/// ```
582583
///
583584
///
@@ -609,10 +610,11 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextClient<'ctx> for CTX {}
609610
/// #
610611
/// # async fn handle(ctx: Context<'_>, id: String) -> Result<(), HandlerError> {
611612
/// // Resolve the awakeable
612-
/// ctx.resolve_awakeable(&id, "hello");
613+
/// ctx.resolve_awakeable(&id, "hello".to_string());
613614
///
614615
/// // Or reject the awakeable
615616
/// ctx.reject_awakeable(&id, TerminalError::new("my error reason"));
617+
/// # Ok(())
616618
/// # }
617619
/// ```
618620
///
@@ -665,7 +667,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextAwakeables<'ctx> for CTX {}
665667
/// let response = ctx.run(|| do_db_request()).await?;
666668
/// # Ok(())
667669
/// # }
668-
/// # fn do_db_request() -> Result<String, HandlerError>{
670+
/// # async fn do_db_request() -> Result<String, HandlerError>{
669671
/// # Ok("Hello".to_string())
670672
/// # }
671673
/// ```

src/http_server.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
//! 3. Listen on the specified port (default `9080`) for connections and requests.
88
//!
99
//! ```
10-
//! use crate::_examples::my_service::{MyService, MyServiceImpl};
11-
//! use crate::_examples::my_virtual_object::{MyVirtualObject, MyVirtualObjectImpl};
12-
//! use crate::_examples::my_workflow::{MyWorkflow, MyWorkflowImpl};
10+
//! # #[path = "../examples/services"]
11+
//! # mod services;
12+
//! # use services::my_service::{MyService, MyServiceImpl};
13+
//! # use services::my_virtual_object::{MyVirtualObject, MyVirtualObjectImpl};
14+
//! # use services::my_workflow::{MyWorkflow, MyWorkflowImpl};
1315
//! use restate_sdk::endpoint::Endpoint;
1416
//! use restate_sdk::http_server::HttpServer;
1517
//!
@@ -36,7 +38,9 @@
3638
//! Add the identity key to your endpoint as follows:
3739
//!
3840
//! ```
39-
//! # use crate::_examples::my_service::{MyService, MyServiceImpl};
41+
//! # #[path = "../examples/services"]
42+
//! # mod services;
43+
//! # use services::my_service::{MyService, MyServiceImpl};
4044
//! # use restate_sdk::endpoint::Endpoint;
4145
//! # use restate_sdk::http_server::HttpServer;
4246
//! #

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,10 @@ pub use restate_sdk_macros::object;
389389
/// Ok(())
390390
/// }
391391
/// async fn get_status(&self, ctx: SharedWorkflowContext<'_>) -> Result<String, HandlerError> {
392-
/// Ok(ctx.get("status").unwrap_or("unknown".to_string()))
392+
/// Ok(ctx.get("status").await?.unwrap_or("unknown".to_string()))
393393
/// }
394394
/// }
395-
/// # fn send_email_with_link(email: String, secret: String) -> Result<(), HandlerError> {
395+
/// # async fn send_email_with_link(email: String, secret: String) -> Result<(), HandlerError> {
396396
/// # Ok(())
397397
/// # }
398398
///

0 commit comments

Comments
 (0)