Skip to content

Commit c1886c3

Browse files
committed
no_run for code snippets
1 parent d8a9aec commit c1886c3

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/context/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl<'ctx> WorkflowContext<'ctx> {
221221
/// ## Durable sleep
222222
/// To sleep in a Restate application for ten seconds, do the following:
223223
///
224-
/// ```
224+
/// ```rust,no_run
225225
/// # use restate_sdk::prelude::*;
226226
/// # use std::convert::Infallible;
227227
/// # use std::time::Duration;
@@ -266,7 +266,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextTimers<'ctx> for CTX {}
266266
///
267267
/// You can do request-response calls to Services, Virtual Objects, and Workflows, in the following way:
268268
///
269-
/// ```
269+
/// ```rust,no_run
270270
/// # #[path = "../../examples/services"]
271271
/// # mod services;
272272
/// # use services::my_service::MyServiceClient;
@@ -329,7 +329,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextTimers<'ctx> for CTX {}
329329
///
330330
/// Handlers can send messages (a.k.a. one-way calls, or fire-and-forget calls), as follows:
331331
///
332-
/// ```
332+
/// ```rust,no_run
333333
/// # #[path = "../../examples/services"]
334334
/// # mod services;
335335
/// # use services::my_service::MyServiceClient;
@@ -369,7 +369,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextTimers<'ctx> for CTX {}
369369
///
370370
/// To schedule a delayed call, send a message with a delay parameter, as follows:
371371
///
372-
/// ```
372+
/// ```rust,no_run
373373
/// # #[path = "../examples/services"]
374374
/// # mod services;
375375
/// # use services::my_service::MyServiceClient;
@@ -409,7 +409,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextTimers<'ctx> for CTX {}
409409
/// Invocations will execute in the same order in which they arrive at Restate.
410410
/// For example, assume a handler calls the same Virtual Object twice:
411411
///
412-
/// ```
412+
/// ```rust,no_run
413413
/// # #[path = "../../examples/services"]
414414
/// # mod services;
415415
/// # use services::my_virtual_object::MyVirtualObjectClient;
@@ -563,7 +563,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextClient<'ctx> for CTX {}
563563
/// 3. **Wait** until the other process has executed the task.
564564
/// The handler **receives the payload and resumes**.
565565
///
566-
/// ```
566+
/// ```rust,no_run
567567
/// # use restate_sdk::prelude::*;
568568
/// #
569569
/// # async fn handle(ctx: Context<'_>) -> Result<(), HandlerError> {
@@ -605,7 +605,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextClient<'ctx> for CTX {}
605605
///
606606
/// - Resolving via the SDK with its ID and an optional payload, or rejecting with its ID and a reason:
607607
///
608-
/// ```
608+
/// ```rust,no_run
609609
/// # use restate_sdk::prelude::*;
610610
/// #
611611
/// # async fn handle(ctx: Context<'_>, id: String) -> Result<(), HandlerError> {
@@ -661,7 +661,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextAwakeables<'ctx> for CTX {}
661661
/// Restate replays the result instead of re-executing the operation on retries.
662662
///
663663
/// Here is an example of a database request for which the string response is stored in Restate:
664-
/// ```
664+
/// ```rust,no_run
665665
/// # use restate_sdk::prelude::*;
666666
/// # async fn handle(ctx: Context<'_>) -> Result<(), HandlerError> {
667667
/// let response = ctx.run(|| do_db_request()).await?;
@@ -692,7 +692,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextAwakeables<'ctx> for CTX {}
692692
///
693693
/// Do not use this in cryptographic contexts.
694694
///
695-
/// ```
695+
/// ```rust,no_run
696696
/// # use restate_sdk::prelude::*;
697697
/// # use uuid::Uuid;
698698
/// # async fn uuid_generate(mut ctx: Context<'_>) {
@@ -706,7 +706,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextAwakeables<'ctx> for CTX {}
706706
/// This returns a new pseudorandom float within the range `[0,1]`.
707707
/// This is the equivalent of JS `Math.random()` but deterministically replayable.
708708
///
709-
/// ```
709+
/// ```rust,no_run
710710
/// # use restate_sdk::prelude::*;
711711
/// # use rand::Rng;
712712
/// async fn rand_generate(mut ctx: Context<'_>) {
@@ -766,7 +766,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx>> ContextSideEffects<'ctx> for CTX {
766766
/// **Info: Serializing state**:
767767
/// You can store any type of value that that implements the `serde::Serialize` and `serde::Deserialize` traits ([see serialization docs][crate::serde]).
768768
///
769-
/// ```
769+
/// ```rust,no_run
770770
/// # use restate_sdk::prelude::*;
771771
/// #
772772
/// # async fn my_handler(ctx: ObjectContext<'_>) -> Result<(), HandlerError> {
@@ -829,7 +829,7 @@ impl<'ctx, CTX: private::SealedContext<'ctx> + private::SealedCanReadState> Cont
829829
/// **Info: Serializing state**:
830830
/// You can store any type of value that that implements the `serde::Serialize` and `serde::Deserialize` traits ([see serialization docs][crate::serde]).
831831
///
832-
/// ```
832+
/// ```rust,no_run
833833
/// # use restate_sdk::prelude::*;
834834
/// #
835835
/// # async fn my_handler(ctx: ObjectContext<'_>) -> Result<(), HandlerError> {

src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//!
99
//! You can throw a terminal exception with an optional HTTP status code and a message anywhere in your handler, as follows:
1010
//!
11-
//! ```
11+
//! ```rust,no_run
1212
//! # use restate_sdk::prelude::*;
1313
//! # async fn handle() -> Result<(), HandlerError> {
1414
//! Err(TerminalError::new("This is a terminal error").into())

src/http_server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//! 2. Bind one or multiple services to it.
77
//! 3. Listen on the specified port (default `9080`) for connections and requests.
88
//!
9-
//! ```
9+
//! ```rust,no_run
1010
//! # #[path = "../examples/services"]
1111
//! # mod services;
1212
//! # use services::my_service::{MyService, MyServiceImpl};
@@ -37,7 +37,7 @@
3737
//! instance. You can find out more about request identity in the [Security docs](https://docs.restate.dev/operate/security#locking-down-service-access).
3838
//! Add the identity key to your endpoint as follows:
3939
//!
40-
//! ```
40+
//! ```rust,no_run
4141
//! # #[path = "../examples/services"]
4242
//! # mod services;
4343
//! # use services::my_service::{MyService, MyServiceImpl};

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ pub use restate_sdk_macros::object;
358358
/// ## Implementing workflows
359359
/// Have a look at the code example to get a better understanding of how workflows are implemented:
360360
///
361-
/// ```
361+
/// ```rust,no_run
362362
/// use restate_sdk::prelude::*;
363363
///
364364
/// #[restate_sdk::workflow]
@@ -376,7 +376,7 @@ pub use restate_sdk_macros::object;
376376
/// async fn run(&self, mut ctx: WorkflowContext<'_>, email: String) -> Result<bool, HandlerError> {
377377
///
378378
/// let secret = ctx.rand_uuid().to_string();
379-
/// ctx.run(|| send_email_with_link(email, secret)).await?;
379+
/// ctx.run(|| send_email_with_link(email.clone(), secret.clone())).await?;
380380
/// ctx.set("status", "Email sent".to_string());
381381
///
382382
/// let click_secret = ctx.promise::<String>("email.clicked").await?;

0 commit comments

Comments
 (0)