Skip to content

feat(rust): rust sdk docs#4412

Open
flippedcoder wants to merge 20 commits intomainfrom
mm/rust-sdk
Open

feat(rust): rust sdk docs#4412
flippedcoder wants to merge 20 commits intomainfrom
mm/rust-sdk

Conversation

@flippedcoder
Copy link
Copy Markdown
Contributor

@flippedcoder flippedcoder commented Apr 8, 2026

What does this PR do?

This adds the docs for the Rust SDK.

Notes to reviewers

┆Attachments: EDU-6184 feat(rust): rust sdk docs

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
temporal-documentation Error Error Apr 27, 2026 8:57pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review

Comment on lines +265 to +266
let connection_options =
ConnectionOptions::new(Url::from_str("http://localhost:7233")?).build();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread docs/develop/rust/activities/basics.mdx Outdated

**How to define Activity parameters using the Temporal Rust SDK.**

There is no explicit limit to the total number of parameters that an [Activity Definition](/activity-definition) may support. However, there is a limit to the total size of the data that ends up encoded into a gRPC message Payload.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Rust we actually have a hard cap of 6 parameters for activities.


We recommend that you use a single struct as an argument that wraps all the application data passed to Activities. This way you can change what data is passed to the Activity without breaking the function signature.

Activity parameters must be serializable and deserializable using serde. Use `#[derive(Serialize, Deserialize)]` on your data types:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a hard requirement, but implementing the serde traits are the easiest way to ensure they work. If they have a protobuf message they can leverage ProstSerializable for encoding without implementing the serde traits.

I am actively working on improving the ergonomics of using protobuf instead of serde, so I don't have a good sample yet.

Comment thread docs/develop/rust/nexus/service-handler.mdx Outdated
Comment thread docs/develop/rust/workflows/timers.mdx Outdated
Comment thread docs/develop/rust/index.mdx
Comment thread sidebars.js
Copy link
Copy Markdown
Member

@Sushisource Sushisource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we've got to figure out a way to make sure we're actually compiling code snippets going directly into docs, because a lot of these would fail to compile.

Super happy to see the progress here, but, we need some automated gates around this AI-generated code otherwise we're going to frustrate a lot of users.

Comment on lines +49 to +53
- Be `async` (return a future)
- Take `ActivityContext` as the first parameter
- Return `Result<T, ActivityError>` where `T` is the return type
- Be `pub` (public)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't mention activities that can take Arc<Self> and be registered using an instance. We should have an example of that somewhere as well.

Comment thread docs/develop/rust/activities/basics.mdx Outdated
Comment on lines +91 to +93
### Define Activity return values {#activity-return-values}

**How to define Activity return values using the Temporal Rust SDK.**
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably just combine this and the above section since they're really dealing with the same concept.

Comment thread docs/develop/rust/activities/basics.mdx Outdated
Comment on lines +163 to +167
Activities return `Result<T, ActivityError>` with different error types for different failure scenarios:

- **`ActivityError::Retryable`** - Transient failure that should be retried according to the Activity's retry policy
- **`ActivityError::NonRetryable`** - Permanent failure that will not be retried
- **`ActivityError::Cancelled`** - Activity was cancelled by the Workflow
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section should probably refer to what the default behavior is for errors bubbled up via ?

(Which I believe is to convert them into a Retryable activity error)

Comment on lines +70 to +72
start_to_close_timeout: Some(Duration::from_secs(10)),
// How long to wait before retrying a failed Activity
schedule_to_close_timeout: Some(Duration::from_secs(60)),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Activity options changed recently so that we require one or both of these timeouts at the type level, this file will need some updates

Comment on lines +271 to +273
// Wait for both to complete
let result1 = future1.await?;
let result2 = future2.await?;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use our join! helper

Comment on lines +114 to +122
// How many Workflow tasks to poll concurrently
.max_concurrent_workflow_task_polls(10)
// How many Activity tasks to poll concurrently
.max_concurrent_activity_task_polls(10)
// How long to wait for tasks from the service
.pollers_config(PollerConfig {
max_tasks_per_poll: 100,
..Default::default()
})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these options are fabricated. xxx_task_poller_behavior is the actual name


## Scale Workers Horizontally {#scale-workers}

You can run multiple Worker processes on different machines, all listening to the same Task Queue:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could but there's essentially zero reason to do so. We should remove this section.

Comment on lines +228 to +234
tokio::select! {
_ = worker.run() => println!("Worker stopped"),
_ = signal::ctrl_c() => {
println!("Received shutdown signal, gracefully shutting down...");
// Worker will complete in-flight tasks
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause us to just stop caring about the worker's run function, which is not what we want, and will mean shutdown is not graceful.

This code needs to instead spawn a task that listens for ctrl_c, and if received, calls the function returned by shutdown_handle() on the worker.

Then, run is always awaited until conclusion


## Define Workflow parameters {#workflow-parameters}

Temporal Workflows may have any number of custom parameters. However, we strongly recommend that objects are used as parameters, so that the object's individual fields may be altered without breaking the signature of the Workflow. All Workflow Definition parameters must be serializable.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Temporal Workflows may have any number of custom parameters. However, we strongly recommend that objects are used as parameters, so that the object's individual fields may be altered without breaking the signature of the Workflow. All Workflow Definition parameters must be serializable.
Temporal Workflows may have any number of custom parameters. However, we strongly recommend that structs are used as parameters, so that the object's individual fields may be altered without breaking the signature of the Workflow. All Workflow Definition parameters must be serializable.

..Default::default()
};

let started = ctx.child_workflow(child_opts).start().await.into_started().unwrap();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither start() nor into_started() exist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants