messages
listlengths
3
3
category
stringclasses
6 values
crate
stringclasses
1 value
source
dict
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Explain the `IntoChooseViewMaybeErased` trait from Leptos router. What does \"maybe erased\" mean in this context, and how do...
code_explanation
leptos
{ "type": "trait_item", "name": "IntoChooseViewMaybeErased", "source_file": "router/src/matching/choose_view.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Explain each field of `NavigateOptions` and when you would override the defaults:\n\n```rust\nfn default() -> Self {\n Sel...
code_explanation
leptos
{ "type": "function_item", "name": "default", "source_file": "router/src/navigate.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Explain how `AttributeValue for Nonce` works in `leptos/src/nonce.rs`. Specifically, why does the nonce need special handling...
code_explanation
leptos
{ "type": "impl_item", "name": "AttributeValue for Nonce", "source_file": "leptos/src/nonce.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Explain the `AtKeyed` struct from Leptos's reactive stores:\n\n```rust\n#[derive(Debug)\npub struct AtKeyed<Inner, Prev, K, V...
code_explanation
leptos
{ "type": "reactive_stores", "name": "AtKeyed", "source_file": "reactive_stores/src/keyed.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Write comprehensive tests for `resolve_path` from `leptos_router::matching::resolve_path`. Cover: (1) an absolute path ignore...
test_generation
leptos
{ "type": "function_item", "name": "resolve_path", "source_file": "router/src/matching/resolve_path.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Explain what this Leptos CSR (client-side rendering) server setup does and why it uses `/api/{*fn_name}` instead of full `lep...
code_explanation
leptos
{ "type": "function_item", "name": "main", "source_file": "examples/todo_app_sqlite_csr/src/main.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "In `reactive_graph/src/signal/arc_rw.rs`, the `SignalDispose` trait is implemented for `ArcRwSignal<T>` as follows:\n\n```rus...
code_explanation
leptos
{ "type": "github", "name": "leptos", "source_file": "reactive_graph/src/signal/arc_rw.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Using the Leptos `defined_at` pattern shown below as inspiration, implement a **new** related function or component that exte...
code_generation
leptos
{ "type": "function_item", "name": "defined_at", "source_file": "reactive_graph/src/actions/action.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Show a practical example of using `handle_server_fns_with_context` in an axum handler to inject both app state and an auth se...
api_usage
leptos
{ "type": "function_item", "name": "server_fn_handler", "source_file": "projects/sso_auth_axum/src/main.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Using Leptos's `on_cleanup` function, implement a `use_interval` composable that sets up a recurring `setInterval`-style call...
code_generation
leptos
{ "type": "function_item", "name": "on_cleanup", "source_file": "reactive_graph/src/owner/mod.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Explain how `clear_sources` fits into Leptos's reactive dependency graph and when it needs to be called:\n\n```rust\nfn clear...
api_usage
leptos
{ "type": "function_item", "name": "clear_sources", "source_file": "reactive_graph/src/computed/inner.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Explain the URL parameter matching algorithm in this `test` function:\n\n```rust\nfn test<'a>(&self, path: &'a str) -> Option...
code_explanation
leptos
{ "type": "function_item", "name": "test", "source_file": "router/src/matching/horizontal/param_segments.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Show how to use `sqlx::query_as` in a Leptos server function to fetch paginated results, using this basic query as a starting...
api_usage
leptos
{ "type": "function_item", "name": "list_users", "source_file": "projects/ory-kratos/app/src/database_calls.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Refactor the following Leptos store-based `App` component. The current code puts all store field access and effect logic inli...
refactoring
leptos
{ "type": "crates.io", "name": "leptos", "source_file": "examples/stores/src/lib.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Refactor the following Rust function/impl `test_multiple_tasks` to improve readability, performance, or idiomatic Rust style....
refactoring
leptos
{ "type": "function_item", "name": "test_multiple_tasks", "source_file": "any_spawner/tests/multiple_tasks.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Generate a complete `try_write` implementation for an async derived signal in Leptos reactive graph:\n\n```rust\nfn try_write...
code_generation
leptos
{ "type": "function_item", "name": "try_write", "source_file": "reactive_graph/src/computed/async_derived/async_derived.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Explain this Axum extractor pattern that retrieves a user from the database using session identity. Walk through each step an...
code_explanation
leptos
{ "type": "impl_item", "name": "ExtractUserRow", "source_file": "projects/ory-kratos/app/src/auth/extractors.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Write tests for the `SlotIf` component that verify: the `then` branch renders when `cond` is `true`, the `else_if` branch ren...
test_generation
leptos
{ "type": "function_item", "name": "SlotIf", "source_file": "examples/slots/src/lib.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Demonstrate how to implement `IntoView` for a custom error type in a Leptos Ory Kratos integration, improving on this basic v...
api_usage
leptos
{ "type": "function_item", "name": "into_view", "source_file": "projects/ory-kratos/app/src/auth/kratos_error.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Write comprehensive tests for the following Leptos/Rust code `into_cloneable_owned`. Include unit tests with real assertions ...
test_generation
leptos
{ "type": "function_item", "name": "into_cloneable_owned", "source_file": "tachys/src/view/either.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Explain the `TEMPLATE` static in the Tera-based TodoMVC benchmark. Why is it a raw string literal and what is the `{{ }}` / `...
api_usage
leptos
{ "type": "generated", "name": "TEMPLATE", "source_file": "benchmarks/src/todomvc/tera.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Explain the `HomePage` component in the regression test app. Why does it use `<a href>` instead of leptos `<A href>` for each...
code_explanation
leptos
{ "type": "generated", "name": "HomePage", "source_file": "examples/regression/src/app.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Write a Leptos e2e test step function `i_see_n_items_in_the_list` that verifies a specific number of `<li>` items appear in a...
code_generation
leptos
{ "type": "function_item", "name": "i_see_the_following_links_being_bolded", "source_file": "examples/suspense_tests/e2e/tests/fixtures/world/check_steps.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Show how to use `query_signal_with_options` from `router/src/hooks.rs` to create a bidirectional binding between a URL query ...
api_usage
leptos
{ "type": "function_item", "name": "query_signal_with_options", "source_file": "router/src/hooks.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Provide a deep technical explanation of the following Leptos/Rust code for `fmt`. Cover: what it does, how it works internall...
code_explanation
leptos
{ "type": "function_item", "name": "fmt", "source_file": "reactive_graph/src/owner.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Show a practical example of using `ArcOnceResource` with `JsonSerdeCodec` in Leptos SSR, and explain when to choose `ArcOnceR...
api_usage
leptos
{ "type": "impl_item", "name": "ArcOnceResource", "source_file": "leptos_server/src/once_resource.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Write a test for the `map` method on `Subfield<S, Option<T>, T>` that verifies it returns `None` when the outer `Option` is `...
test_generation
leptos
{ "type": "function_item", "name": "map", "source_file": "reactive_stores/src/option.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Generate a complete `Model` struct for a Leptos component macro processor. The struct should represent a component definition...
code_generation
leptos
{ "type": "struct_item", "name": "Model", "source_file": "leptos_macro/src/component.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "I'm writing end-to-end tests for a Leptos todo app using a WebDriver client. Write an async helper `is_todo_present(client, t...
code_generation
leptos
{ "type": "function_item", "name": "is_todo_present", "source_file": "examples/todo_app_sqlite/e2e/tests/fixtures/check.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Find the bug in `i_select_the_following_links` — the function iterates over a BDD table but silently does nothing if the tabl...
bug_detection
leptos
{ "type": "function_item", "name": "i_select_the_following_links", "source_file": "examples/regression/e2e/tests/fixtures/world/action_steps.rs" }