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 `clone` implementation for the event queue in `bevy3d_ui`. Why does cloning a channel sender/receiver pair make s...
code_explanation
leptos
{ "type": "function_item", "name": "clone", "source_file": "projects/bevy3d_ui/src/demos/bevydemo1/eventqueue/events.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Refactor this leptos code to be more idiomatic and maintainable (`new` from `examples/todo_app_sqlite_axum/e2e/tests/fixtures...
refactoring
leptos
{ "type": "function_item", "name": "new", "source_file": "examples/todo_app_sqlite_axum/e2e/tests/fixtures/world/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 the following leptos code in depth (`About` from `examples/islands_router/src/app.rs`):\n\n```rust\npub fn About() ->...
code_explanation
leptos
{ "type": "function_item", "name": "About", "source_file": "examples/islands_router/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": "Find the bug in this `TryFrom<String>` implementation for a `Password` type:\n\n```rust\nfn try_from(p: String) -> Result<Sel...
bug_detection
leptos
{ "type": "function_item", "name": "try_from", "source_file": "projects/ory-kratos/app/src/auth.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 `element_exists` does and why `expect` with a formatted message is used instead of `?` for error propagation in ...
code_explanation
leptos
{ "type": "function_item", "name": "element_exists", "source_file": "examples/lazy_routes/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": "Write doc-tested unit tests for the `version()`, `input()`, and `value()` methods of `ArcAction` in `leptos_reactive`. Each t...
test_generation
leptos
{ "type": "impl_item", "name": "ArcAction", "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": "Generate an `init_smol` executor initializer for `any_spawner` that uses the `smol` async runtime, following the same pattern...
code_generation
leptos
{ "type": "generated", "name": "init_async_executor", "source_file": "any_spawner/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": "Write unit tests for this `PartialEq` implementation on `MappedMutArc`:\n\n```rust\nimpl<Inner, U: PartialEq> PartialEq for M...
test_generation
leptos
{ "type": "impl_item", "name": "PartialEq", "source_file": "reactive_graph/src/signal/guards.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 `Property<K, P>` struct and `SendWrapper` in leptos — why is the value wrapped in `Option<SendWrapper<P>>` and wh...
api_usage
leptos
{ "type": "struct_item", "name": "Property", "source_file": "tachys/src/html/property.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 `tuples!` macro does and how it enables implementing `IntoFragment` for tuple types in Leptos's view system...
code_explanation
leptos
{ "type": "macro_definition", "name": "tuples", "source_file": "tachys/src/view/fragment.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Implement the `hydrate` method for a `Doctype` node in tachys. Explain why the implementation is intentionally a no-op, what ...
code_generation
leptos
{ "type": "crates.io", "name": "tachys", "source_file": "tachys/src/html/mod.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Implement `AddAnyAttr` for a custom reactive wrapper `Mapped<F, V>` where `F: ReactiveFunction<Output = V>` and `V: RenderHtm...
code_generation
leptos
{ "type": "impl_item", "name": "AddAnyAttr", "source_file": "tachys/src/reactive_graph/mod.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Based on the Leptos codebase pattern shown below from `leptos/src/into_view.rs`, write a new, related but distinct function o...
code_generation
leptos
{ "type": "trait_item", "name": "CollectView", "source_file": "leptos/src/into_view.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Refactor `ident_from_tag_name` to handle kebab-case tag names by converting them to snake_case identifiers:\n\n```rust\npub(c...
refactoring
leptos
{ "type": "function_item", "name": "ident_from_tag_name", "source_file": "leptos_macro/src/view/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 the `Write` trait implementation for `ArcWriteSignal<T>` in Leptos's `reactive_graph` crate. Specifically, why does `...
code_explanation
leptos
{ "type": "reactive_graph", "name": "Write for ArcWriteSignal<T>", "source_file": "reactive_graph/src/signal/arc_write.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "The following Leptos component uses two parallel `<Suspense>` blocks. A reviewer says it has a bug: the counter increment but...
bug_detection
leptos
{ "type": "crate_source", "name": "Parallel (suspense_tests)", "source_file": "examples/suspense_tests/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": "Implement `KeyedAccess<K>` for `VecDeque<T>` so it can be used in reactive store keyed iteration." }, { "role": "assi...
code_generation
leptos
{ "type": "impl_item", "name": null, "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": "Walk me through the `Todos` component from a Leptos todo app that uses SQLite + Axum. The component uses `Resource`, `ServerA...
code_explanation
leptos
{ "type": "crates.io", "name": "leptos", "source_file": "examples/todo_app_sqlite_axum/src/todo.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 `lazy_route_impl` pattern shown below as inspiration, implement a **new** related function or component that...
code_generation
leptos
{ "type": "function_item", "name": "lazy_route_impl", "source_file": "router_macro/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": "Implement `Render for Vec<T>` in tachys, including `build` (which creates a `VecState` with a marker node) and `rebuild` (whi...
code_generation
leptos
{ "type": "source_code", "name": "Render for Vec<T>", "source_file": "tachys/src/view/iterators.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 complete Cucumber `World` step implementation that includes `i_click_the_button` as part of a counter increment test,...
code_generation
leptos
{ "type": "function_item", "name": "i_click_the_button", "source_file": "examples/todo_app_sqlite/e2e/tests/fixtures/world/action_steps.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "I have an `ArcAsyncDerived<T>` value and I want to make sure that the current reactive scope is subscribed to it so changes w...
api_usage
leptos
{ "type": "function_item", "name": "track", "source_file": "reactive_graph/src/computed/async_derived/arc_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": "Implement a Leptos component that uses `aria_valuenow` to create an accessible progress bar:\n\n```rust\nfn aria_valuenow(\n ...
code_generation
leptos
{ "type": "function_item", "name": "aria_valuenow", "source_file": "tachys/src/html/attribute/aria.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 `App` component in the Tauri example to use a `Resource` instead of a `ServerAction` + `Effect` pattern for fetc...
refactoring
leptos
{ "type": "generated", "name": "App", "source_file": "projects/tauri-from-scratch/src-orig/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 complete Leptos example that persists a reactive `Store<UserPreferences, LocalStorage>` to the browser's `localStorag...
code_generation
leptos
{ "type": "impl_item", "name": "[unnamed]", "source_file": "reactive_stores/src/serde.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 `Resource<T, FromToStringCodec>` for a simple string-based server function. Explain when to...
api_usage
leptos
{ "type": "impl_item", "name": "None", "source_file": "server_fn/src/codec/string.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 `try_new_put_streaming` server function request builder:\n\n```rust\nfn try_new_put_streaming(\n path:...
test_generation
leptos
{ "type": "function_item", "name": "try_new_put_streaming", "source_file": "server_fn/src/request/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 what `Oco` (\"Owned, Counted, or Owned\") is in Leptos and what `clone_inplace` does in this test:\n\n```rust\nfn clo...
code_explanation
leptos
{ "type": "function_item", "name": "cloned_inplace_owned_string_should_make_counted_st", "source_file": "oco/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": "How do I implement `FromReq` for a custom type `T` using the PUT HTTP method in `server_fn`? Show me the full trait implement...
api_usage
leptos
{ "type": "source_code", "name": "FromReq for T (Put)", "source_file": "server_fn/src/codec/put.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 component that uses `html_len` on `Option<impl RenderHtml>` to pre-allocate SSR string buffers. Explain how the `matc...
code_generation
leptos
{ "type": "function_item", "name": "html_len", "source_file": "tachys/src/view/iterators.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 `InnerHtmlValue` trait in Leptos's tachys crate and what `AsyncOutput` and `Send` requirements mean:\n\n```rust\n...
code_explanation
leptos
{ "type": "trait_item", "name": "InnerHtmlValue", "source_file": "tachys/src/html/element/inner_html.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "The JS const in tachys/src/renderer/sledgehammer.rs embeds raw JavaScript defining a Queue. Refactor to split it into named d...
refactoring
leptos
{ "type": "const_item", "name": "JS", "source_file": "tachys/src/renderer/sledgehammer.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Create an enhanced `Default` implementation for a Leptos app's `User` type that also includes role-based defaults:\n\n```rust...
code_generation
leptos
{ "type": "impl_item", "name": "Default", "source_file": "projects/session_auth_axum/src/auth.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "This `add_any_attr` implementation for a `TitleView` type simply returns `self`, ignoring the attribute. Is this a bug or int...
bug_detection
leptos
{ "type": "function_item", "name": "add_any_attr", "source_file": "meta/src/title.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, real-world usage example of `open_websocket` from `examples/server_fns_axum/src/app.rs` in a leptos applica...
api_usage
leptos
{ "type": "function_item", "name": "open_websocket", "source_file": "examples/server_fns_axum/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": "Show a practical, real-world usage example of the `GetValue` API from `reactive_graph/src/traits.rs` in a Leptos application....
api_usage
leptos
{ "type": "impl_item", "name": "GetValue", "source_file": "reactive_graph/src/traits.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, real-world usage example of `add_any_attr` from `meta/src/html.rs` in a leptos application.\n\nSource:\n```...
api_usage
leptos
{ "type": "function_item", "name": "add_any_attr", "source_file": "meta/src/html.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Implement a `WindowListenerHandle` struct in Leptos that holds a cleanup closure, and provide a `remove` method that consumes...
code_generation
leptos
{ "type": "leptos_dom", "name": "WindowListenerHandle::remove", "source_file": "leptos_dom/src/helpers.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 `attribute_to_tokens` function in Leptos's proc-macro system. What is the difference between a `Block` attribute ...
api_usage
leptos
{ "type": "function_item", "name": "attribute_to_tokens", "source_file": "leptos_macro/src/view/mod.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 `find::link_with_text` from Leptos e2e test fixtures to write a complete test step that navigates via a link ...
api_usage
leptos
{ "type": "function_item", "name": "link_with_text", "source_file": "examples/suspense_tests/e2e/tests/fixtures/find.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 Leptos server function that waits a specified number of seconds and demonstrate it with Suspense:\n\n```rust\nasyn...
code_generation
leptos
{ "type": "synthetic", "name": "first_wait_fn", "source_file": "examples/suspense_tests/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 comprehensive tests for `hydrate` from `tachys/src/reactive_graph/class.rs`.\n\nCode:\n```rust\nfn hydrate<const FROM_S...
test_generation
leptos
{ "type": "function_item", "name": "hydrate", "source_file": "tachys/src/reactive_graph/class.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+Axum backend component for managing post permissions. Based on the `PostPermission` struct, create a server fu...
code_generation
leptos
{ "type": "impl_item", "name": "PostPermission", "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": "Implement the `Render` trait for `SuspenseBoundary` including the complex `build` method that manages `nth_run` tracking to a...
code_generation
leptos
{ "type": "impl_item", "name": "Render", "source_file": "leptos/src/suspense_component.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Demonstrate practical use of `FromRes<Patch<Encoding>, ...>` in a Leptos server function that uses a PATCH HTTP method to per...
api_usage
leptos
{ "type": "impl_item", "name": "T", "source_file": "server_fn/src/codec/patch.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "The following Leptos component test is supposed to build `ComponentProps` with several field types and assert that they round...
bug_detection
leptos
{ "type": "test", "name": "component", "source_file": "leptos_macro/tests/component.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "How do I implement the `rebuild` method on a custom `AttributeValue` in leptos/tachys to update a DOM attribute efficiently? ...
api_usage
leptos
{ "type": "function_item", "name": "rebuild", "source_file": "tachys/src/html/attribute/value.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 `to_html_with_buf` method on tachys HTML elements that verify self-closing tags are not given a closing t...
test_generation
leptos
{ "type": "function_item", "name": "to_html_with_buf", "source_file": "tachys/src/html/element/mod.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Refactor this `TextStream` `From` implementation to add error handling for stream items that fail to convert to `String`, ins...
refactoring
leptos
{ "type": "impl_item", "name": null, "source_file": "server_fn/src/codec/stream.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "The `rebuild` function for `KeyedState` rebuilds a keyed list. Refactor to extract a helper `compute_diff(old: &FxIndexSet<K>...
refactoring
leptos
{ "type": "function_item", "name": "rebuild", "source_file": "leptos/src/for_loop.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 role of this `From` implementation in a Leptos hexagonal architecture application:\n\n```rust\nimpl From<DomainDa...
code_explanation
leptos
{ "type": "impl_item", "name": "UiMappingFromDomainData2", "source_file": "projects/hexagonal-architecture/src/trait_impl.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Based on the Leptos codebase pattern shown below from `tachys/src/html/attribute/mod.rs`, write a new, related but distinct f...
code_generation
leptos
{ "type": "function_item", "name": "hydrate", "source_file": "tachys/src/html/attribute/mod.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 Rust function `build_route_url(base: &str, segments: &[&str]) -> String` that constructs a URL by joining a base path...
code_generation
leptos
{ "type": "tachys_source", "name": "finish_route", "source_file": "tachys/src/html/attribute/global.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 the `TryRes` trait to build HTTP responses in a Leptos server function context. Provide examples of building ...
api_usage
leptos
{ "type": "impl_item", "name": null, "source_file": "server_fn/src/response/generic.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Create a new leptos implementation for a task inspired by `Errors` from `leptos/src/error_boundary.rs`.\n\nReference code:\n`...
code_generation
leptos
{ "type": "impl_item", "name": "Errors", "source_file": "leptos/src/error_boundary.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 `MatchNestedRoutes` pattern shown below as inspiration, implement a **new** related function or component th...
code_generation
leptos
{ "type": "trait_item", "name": "MatchNestedRoutes", "source_file": "router/src/matching/mod.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 `App` component that uses lazy routes (code-split by route) with a shared `RwSignal<i32>` count provided as co...
code_generation
leptos
{ "type": "function_item", "name": "App", "source_file": "examples/lazy_routes/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": "Create a new leptos implementation for a task inspired by `call_redirect_hook` from `server_fn/src/redirect.rs`.\n\nReference...
code_generation
leptos
{ "type": "function_item", "name": "call_redirect_hook", "source_file": "server_fn/src/redirect.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Write unit tests for a function that calls `to_html_with_buf` on an erased view type, verifying that the output buffer is pop...
test_generation
leptos
{ "type": "function_item", "name": "to_html", "source_file": "tachys/src/view/any_view.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Review this Leptos `App` function from an nginx MPMC example for bugs:\n\n```rust\npub fn App() -> impl IntoView {\n // Pr...
bug_detection
leptos
{ "type": "function_item", "name": "App", "source_file": "projects/nginx-mpmc/app-1/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": "Show a practical example of `with_observer_untracked` for implementing a reactive primitive that needs to read other signals ...
api_usage
leptos
{ "type": "generated", "name": "with_observer_untracked", "source_file": "reactive_graph/src/graph/subscriber.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "The following manual `Clone` implementation for `ArcField<T>` has a bug: one of the fields is cloned with `.clone()` instead ...
bug_detection
leptos
{ "type": "crate_source", "name": "Clone for ArcField<T>", "source_file": "reactive_stores/src/arc_field.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "The following `ParentRoute` component compiles but has a subtle bug. Identify the bug, explain why it causes incorrect behavi...
bug_detection
leptos
{ "type": "derived", "name": "ParentRoute", "source_file": "router/src/components.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Generate the complete `server_fn_error` helper module for Leptos server functions. Include the error enum variants, Display i...
code_generation
leptos
{ "type": "macro_definition", "name": "server_fn_error", "source_file": "server_fn/src/error.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "The following `to_html_with_buf` implementation on a view template wrapper delegates to its inner view. Identify a subtle cor...
bug_detection
leptos
{ "type": "function_item", "name": "to_html_with_buf", "source_file": "tachys/src/view/template.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 writing a Leptos server function that extracts a database pool and authenticated user from Axum e...
api_usage
leptos
{ "type": "function_item", "name": "get_post_list", "source_file": "projects/ory-kratos/app/src/posts/posts_page.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 the `RegenerationFn` `Debug` implementation pattern to add a custom `Debug` impl for a struct containing a no...
api_usage
leptos
{ "type": "impl_item", "name": "Debug", "source_file": "router/src/static_routes.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Refactor `fetch_example` to extract the error fallback view and the count input into separate components, improving code orga...
refactoring
leptos
{ "type": "function_item", "name": "fetch_example", "source_file": "examples/fetch/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 this `From<Store<T, S>>` for `ArcField` to use builder-style methods instead of `Arc::new(move || ...)` closures inl...
refactoring
leptos
{ "type": "function_item", "name": "from", "source_file": "reactive_stores/src/field.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Implement `IntoParam for Option<T>` from `router/src/params.rs`. This trait converts a route segment string into a typed para...
code_generation
leptos
{ "type": "internal", "name": "IntoParam for Option<T>", "source_file": "router/src/params.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, real-world usage example of `try_into_string` from `server_fn/src/request/spin.rs` in a leptos application....
api_usage
leptos
{ "type": "function_item", "name": "try_into_string", "source_file": "server_fn/src/request/spin.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 `to_html_with_buf` pattern shown below as inspiration, implement a **new** related function or component tha...
code_generation
leptos
{ "type": "function_item", "name": "to_html_with_buf", "source_file": "tachys/src/view/error_boundary.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 `try_new` pattern shown below as inspiration, implement a **new** related function or component that extends...
code_generation
leptos
{ "type": "function_item", "name": "try_new", "source_file": "reactive_graph/src/signal/guards.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 `BodyViewState<At>` that verifies `elements()` returns the document body element." }, { "role": "ass...
test_generation
leptos
{ "type": "impl_item", "name": "Mountable", "source_file": "meta/src/body.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "The following Rust function `resolve` has a bug. Identify the bug and provide the corrected version.\n\n**Buggy code:**\n```r...
bug_detection
leptos
{ "type": "function_item", "name": "resolve", "source_file": "tachys/src/html/class.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 `match_nested` that verify: correct matching with a required segment, handling of optional segments, and that...
test_generation
leptos
{ "type": "function_item", "name": "match_nested", "source_file": "router/src/matching/nested/mod.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Design the `NestedRoutesView` struct for the leptos nested router. Explain the role of each field and why `set_is_routing` is...
code_generation
leptos
{ "type": "struct_item", "name": "NestedRoutesView", "source_file": "router/src/nested_router.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "The `Await` component below has a subtle bug involving how it reads from the resolved resource. Identify the bug and provide ...
bug_detection
leptos
{ "type": "function_item", "name": "Await", "source_file": "leptos/src/await_.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 `test_memo_multiple_read_guards` regression test in detail. What bug was it fixing and why can multiple read guar...
code_explanation
leptos
{ "type": "generated", "name": "test_memo_multiple_read_guards", "source_file": "reactive_graph/tests/memo.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 `link_text_is_aria_current` in a Leptos end-to-end test suite to verify that the active navigation link has t...
api_usage
leptos
{ "type": "function_item", "name": "link_text_is_aria_current", "source_file": "examples/suspense_tests/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 this `effect_base` function from Leptos reactive graph:\n\n```rust\nfn effect_base() -> (Receiver, Owner, Arc...
bug_detection
leptos
{ "type": "function_item", "name": "effect_base", "source_file": "reactive_graph/src/effect/effect.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Refactor this browser server-function request constructor to reduce duplication and improve clarity. It builds a `fetch` requ...
refactoring
leptos
{ "type": "function_item", "name": "try_new_req_multipart", "source_file": "server_fn/src/request/browser.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "The `Test` component drives a `<For>` loop with animated transitions from one set of items to another. Write a similar `Anima...
code_generation
leptos
{ "type": "function_item", "name": "Test", "source_file": "examples/animated_show/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": "Generate a `hydrate_islands` entry point that calls `leptos::mount::hydrate_islands` for an islands-architecture app." }, ...
code_generation
leptos
{ "type": "generated", "name": "hydrate", "source_file": "examples/server_fns_axum/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": "In a Leptos + Bevy integration project, describe how to implement a `Scene` struct that sets up a Bevy app embedded in an HTM...
code_generation
leptos
{ "type": "example_project", "name": "Scene", "source_file": "projects/bevy3d_ui/src/demos/bevydemo1/scene.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 `ArcResource::new` that verify: the resource fetches on creation, the resource refetches when the source sign...
test_generation
leptos
{ "type": "impl_item", "name": "None", "source_file": "reactive_graph/src/computed/arc_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": "Show how to implement `PossibleRouteMatch` for a custom route matcher that handles versioned API paths like `/v1/...`, `/v2/....
api_usage
leptos
{ "type": "impl_item", "name": "PossibleRouteMatch", "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": "Explain in depth what `ServerMultiAction` is in Leptos, how it differs from `ServerAction`, and when you would choose one ove...
code_explanation
leptos
{ "type": "struct_item", "name": "ServerMultiAction", "source_file": "leptos_server/src/multi_action.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 function `WithUntracked`:\n\n```rust\npub trait WithUntracked: DefinedAt {...
test_generation
leptos
{ "type": "trait_item", "name": "WithUntracked", "source_file": "reactive_graph/src/traits.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 `clear_subscribers` on a reactive graph source to force all dependent effects to stop tracking a signal, with...
api_usage
leptos
{ "type": "function_item", "name": "clear_subscribers", "source_file": "reactive_graph/src/graph/source.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Implement a `mount_with_fallback` function that wraps the `ErrorBoundary` mount logic: it mounts a child view when there are ...
code_generation
leptos
{ "type": "function_item", "name": "mount", "source_file": "leptos/src/error_boundary.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 `RenderHtml` implementation for iterator-based views in Leptos tachys:\n\n```rust\nimpl<T> RenderHtml for Vec<T>\n...
code_generation
leptos
{ "type": "impl_item", "name": "RenderHtml", "source_file": "tachys/src/view/iterators.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Implement a `mount` function for `Result<T, E>` where `T: Mountable` that only mounts if the result is `Ok`." }, { "r...
code_generation
leptos
{ "type": "function_item", "name": "mount", "source_file": "tachys/src/reactive_graph/mod.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 `ResolvedStaticPath::build`. The function spawns an async task that renders a page and writes it to disk, the...
test_generation
leptos
{ "type": "crate_source", "name": "ResolvedStaticPath::build", "source_file": "router/src/static_routes.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 `into_req` method that converts server function arguments into an HTTP request, verifying the content typ...
test_generation
leptos
{ "type": "function_item", "name": "into_req", "source_file": "server_fn/src/codec/post.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 `insert_before_this` from the mock DOM renderer in Leptos's tachys crate. When would you ne...
api_usage
leptos
{ "type": "function_item", "name": "insert_before_this", "source_file": "tachys/src/renderer/mock_dom.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 tachys rendering system, implement an `IntoStyleValue` for a type `Toggled<const V: &'static str>` that wraps ...
code_generation
leptos
{ "type": "impl_item", "name": "IntoStyleValue", "source_file": "tachys/src/html/style.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 `ActixRequest::from((HttpRequest, Payload))` in an Actix handler that adapts the request for a server functio...
api_usage
leptos
{ "type": "generated", "name": "ActixRequest", "source_file": "server_fn/src/request/actix.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 `DefinedAt` trait implementation on `OnceResource` in Leptos. The trait tracks where in source code a reactiv...
test_generation
leptos
{ "type": "impl_item", "name": "DefinedAt", "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": "Implement `rebuild` for a reactive view that replaces the old mounted state with a newly-built one using `insert_before_this`...
code_generation
leptos
{ "type": "function_item", "name": "rebuild", "source_file": "tachys/src/reactive_graph/mod.rs" }