|
75 | 75 | //! |
76 | 76 | //! ```rust,no_run |
77 | 77 | //!use restate_sdk::prelude::*; |
78 | | -//! |
| 78 | +//! |
79 | 79 | //! #[restate_sdk::object] |
80 | 80 | //! pub trait MyVirtualObject { |
81 | 81 | //! async fn my_handler(name: String) -> Result<String, HandlerError>; |
82 | 82 | //! #[shared] |
83 | 83 | //! async fn my_concurrent_handler(name: String) -> Result<String, HandlerError>; |
84 | 84 | //! } |
85 | | -//! |
| 85 | +//! |
86 | 86 | //! pub struct MyVirtualObjectImpl; |
87 | | -//! |
| 87 | +//! |
88 | 88 | //! impl MyVirtualObject for MyVirtualObjectImpl { |
89 | 89 | //! async fn my_handler( |
90 | 90 | //! &self, |
|
101 | 101 | //! Ok(format!("{} {}", greeting, ctx.key())) |
102 | 102 | //! } |
103 | 103 | //! } |
104 | | -//! |
| 104 | +//! |
105 | 105 | //! #[tokio::main] |
106 | 106 | //! async fn main() { |
107 | 107 | //! tracing_subscriber::fmt::init(); |
|
128 | 128 | //! |
129 | 129 | //! ```rust,no_run |
130 | 130 | //! use restate_sdk::prelude::*; |
131 | | -//! |
| 131 | +//! |
132 | 132 | //! #[restate_sdk::workflow] |
133 | 133 | //! pub trait MyWorkflow { |
134 | 134 | //! async fn run(req: String) -> Result<String, HandlerError>; |
135 | 135 | //! #[shared] |
136 | 136 | //! async fn interact_with_workflow() -> Result<(), HandlerError>; |
137 | 137 | //! } |
138 | | -//! |
| 138 | +//! |
139 | 139 | //! pub struct MyWorkflowImpl; |
140 | | -//! |
| 140 | +//! |
141 | 141 | //! impl MyWorkflow for MyWorkflowImpl { |
142 | 142 | //! async fn run(&self, ctx: WorkflowContext<'_>, req: String) -> Result<String, HandlerError> { |
143 | 143 | //! //! implement workflow logic here |
144 | | -//! |
| 144 | +//! |
145 | 145 | //! Ok(String::from("success")) |
146 | 146 | //! } |
147 | 147 | //! async fn interact_with_workflow(&self, ctx: SharedWorkflowContext<'_>) -> Result<(), HandlerError> { |
148 | 148 | //! //! implement interaction logic here |
149 | 149 | //! //! e.g. resolve a promise that the workflow is waiting on |
150 | | -//! |
| 150 | +//! |
151 | 151 | //! Ok(()) |
152 | 152 | //! } |
153 | 153 | //! } |
154 | | -//! |
| 154 | +//! |
155 | 155 | //! #[tokio::main] |
156 | 156 | //! async fn main() { |
157 | 157 | //! tracing_subscriber::fmt::init(); |
@@ -217,7 +217,6 @@ pub mod http_server; |
217 | 217 | pub mod hyper; |
218 | 218 | pub mod serde; |
219 | 219 |
|
220 | | -use ::serde::de::StdError; |
221 | 220 | /// Entry-point macro to define a Restate [Service](https://docs.restate.dev/concepts/services#services-1). |
222 | 221 | /// |
223 | 222 | /// ```rust,no_run |
@@ -483,7 +482,6 @@ pub use restate_sdk_macros::object; |
483 | 482 | /// |
484 | 483 | /// For more details, check the [`service` macro](macro@crate::service) documentation. |
485 | 484 | pub use restate_sdk_macros::workflow; |
486 | | -use crate::errors::TerminalError; |
487 | 485 |
|
488 | 486 | /// Prelude contains all the useful imports you need to get started with Restate. |
489 | 487 | pub mod prelude { |
|
0 commit comments