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 `AtIndex::new` in `reactive_stores::iter` — what is `defined_at`, why is `PhantomData` used for the type parameter, a...
code_explanation
leptos
{ "type": "impl_item", "name": null, "source_file": "reactive_stores/src/iter.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 new end-to-end test step function for a Leptos e2e test suite (using the `fantoccini`/`cucumber` pattern already pres...
code_generation
leptos
{ "type": "function_item", "name": "i_see_the_link_being_bolded", "source_file": "examples/suspense_tests/e2e/tests" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Write a Cucumber step definition for an end-to-end test of a Leptos todo app. The step should implement:\n\n```\nWhen I delet...
test_generation
leptos
{ "type": "example", "name": "todo_app_sqlite_csr", "source_file": "examples/todo_app_sqlite_csr/e2e/tests/steps.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 `examples/server_fns_axum/src/app.rs`, write a new, related but distinc...
code_generation
leptos
{ "type": "function_item", "name": "length_of_input", "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": "The following implements `Serialize` for `RwSignal<T, St>` in Leptos. Implement the corresponding `Deserialize` for it, and e...
code_generation
leptos
{ "type": "impl_item", "name": "Serialize", "source_file": "reactive_graph/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": "Write tests for `get_config_from_str` in leptos_config. Cover: (1) valid `[package.metadata.leptos]` section, (2) valid `[[wo...
test_generation
leptos
{ "type": "generated", "name": "get_config_from_str", "source_file": "leptos_config/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 a `Mountable` implementation for a `SplitView<A, B>` struct that renders two views side-by-side, delegating mount/unmou...
code_generation
leptos
{ "type": "impl_item", "name": "Mountable", "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": "Generate additional test cases for `Oco<str>` debug formatting. Add tests for: (1) empty string, (2) string containing escape...
code_generation
leptos
{ "type": "generated", "name": "debug_fmt_should_display_quotes_for_strings", "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": "Create a `StreamBuilder::append` function that merges two SSR stream builders together. Then write a helper that appends a st...
code_generation
leptos
{ "type": "function_item", "name": "append", "source_file": "tachys/src/ssr/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 a `shell` function for a Leptos + Axum SSR application. This function generates the HTML shell that wraps the serve...
code_generation
leptos
{ "type": "function_item", "name": "shell", "source_file": "examples/axum_js_ssr/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 `From<&'static str> for TextProp` in `leptos/src/text_prop.rs`. The conversion should wrap the static string slice ...
code_generation
leptos
{ "type": "function_item", "name": "From<&'static str> for TextProp", "source_file": "leptos/src/text_prop.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Explain `ReactiveFunction` in tachys — what is the difference between `invoke` and `into_shared`, and why does `into_shared` ...
code_explanation
leptos
{ "type": "impl_item", "name": "ReactiveFunction", "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": "Show how `ArcField` from `reactive_stores` is used in Leptos to get a thread-safe field reference from a reactive store. Demo...
api_usage
leptos
{ "type": "impl_item", "name": "arc_field", "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": "Write tests for the `Render` trait implementation in `tachys::html::mod`. The tests should verify that elements render correc...
test_generation
leptos
{ "type": "impl_item", "name": "Render", "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": "Show a complete login flow in a Leptos + Axum application using `get_from_username_with_passhash`. Include the server functio...
api_usage
leptos
{ "type": "function_item", "name": "get_from_username_with_passhash", "source_file": "projects/social-media-ssr/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": "Write thorough tests for the `postcard_example` server function from `examples/server_fns_axum/src/app.rs`. The function slee...
test_generation
leptos
{ "type": "function_item", "name": "postcard_example", "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": "The following Leptos/Rust code for `AttributeValue` contains a subtle bug. Identify the bug, explain why it's problematic in ...
bug_detection
leptos
{ "type": "impl_item", "name": "AttributeValue", "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": "Show a complete practical example of using `build_client` from `examples/regression/e2e/tests/fixtures/world/mod.rs` to write...
api_usage
leptos
{ "type": "function_item", "name": "build_client", "source_file": "examples/regression/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": "Write a complete Leptos component for the `RouterContext` debug format. Show how to implement custom `Debug` for a struct wit...
code_generation
leptos
{ "type": "function_item", "name": "fmt", "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": "Provide a deep technical explanation of the following Leptos/Rust code for `RkyvError`. Cover what it does, why it's structur...
code_explanation
leptos
{ "type": "impl_item", "name": "RkyvError", "source_file": "leptos_server/src/serializers.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 `to_html` works in `leptos_hot_reload/src/node.rs`. What is the `LeptosdNode` type, and how does the recursive co...
code_explanation
leptos
{ "type": "source_code", "name": "to_html", "source_file": "leptos_hot_reload/src/node.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 Leptos nested route structure for a dashboard with an assignments section. The outer route should require authentica...
code_generation
leptos
{ "type": "function_item", "name": "Routes4088", "source_file": "examples/regression/src/issue_4088.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "This `Clone` implementation for `ArcAsyncDerived<T>` compiles fine in debug mode but has a structural issue. Find the bug.\n\...
bug_detection
leptos
{ "type": "impl_item", "name": "Clone", "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": "Explain the structure of this Leptos `TodoApp` component and how its nested routing works:\n\n```rust\npub fn TodoApp() -> im...
code_explanation
leptos
{ "type": "function_item", "name": "TodoApp", "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": "Identify the bug in this test helper function and provide a corrected version:\n\n```rust\npub async fn text_at_id(client: &C...
bug_detection
leptos
{ "type": "function_item", "name": "text_at_id", "source_file": "examples/lazy_routes/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": "Implement the Leptos `<Transition>` component from scratch as a learning exercise. Explain each step: what `SuspenseContext` ...
code_generation
leptos
{ "type": "function_item", "name": "Transition", "source_file": "leptos/src/transition.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 `Clone` implementation for `ArcLocalResource<T>` in leptos to reduce boilerplate, ideally by deriving `Clone` w...
refactoring
leptos
{ "type": "impl_item", "name": "Clone", "source_file": "leptos_server/src/local_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 comprehensive tests for the following Leptos/Rust code `optional`. Include unit tests with real assertions that verify ...
test_generation
leptos
{ "type": "function_item", "name": "optional", "source_file": "router/src/matching/nested/any_nested_route.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 `to_html_with_buf` method in `router/src/flat_router.rs`. What is `RouteList::is_generating()`, when is it `true`...
code_explanation
leptos
{ "type": "function_item", "name": "to_html_with_buf", "source_file": "router/src/flat_router.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Explain or work with this Leptos code from `router/src/params.rs`:\n\n```rust\nimpl ParamsMap {\n /// Creates an empty map...
code_explanation
leptos
{ "type": "impl_item", "name": "ParamsMap", "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": "Write unit and integration tests for an `AppWorld` struct used in end-to-end tests of a web application with Ory Kratos authe...
test_generation
leptos
{ "type": "github", "name": "leptos", "source_file": "projects/ory-kratos/e2e/tests/app_world.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 `ToAnySubscriber` impl for `ArcLocalResource<T>`. What is an `AnySubscriber`, why does `ArcLocalResource` delegat...
code_explanation
leptos
{ "type": "impl_item", "name": "ToAnySubscriber", "source_file": "leptos_server/src/local_resource.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Complete the following test so that it also verifies the signal value after splitting and that the write half can update the ...
code_generation
leptos
{ "type": "function_item", "name": "into_inner_signal", "source_file": "reactive_graph/tests/signal.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 `click_logout` end-to-end test step used in the ory-kratos Leptos integration. What does it do, what browser inte...
code_explanation
leptos
{ "type": "source_code", "name": "click_logout", "source_file": "projects/ory-kratos/e2e/steps/logout.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Refactor `see_err` to return a more descriptive error type and add a configurable timeout:\n\n```rust\npub async fn see_err(w...
refactoring
leptos
{ "type": "generated", "name": "see_err", "source_file": "projects/ory-kratos/e2e/tests/fixtures/steps.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 `into_cloneable` implementation for `Either<L, R>` to use a more functional style and add a doc comment explain...
refactoring
leptos
{ "type": "impl_item", "name": "into_cloneable", "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": "Show how to use `StoreFieldWriter::new` to create a write guard for a reactive store field, and demonstrate untracked mutatio...
api_usage
leptos
{ "type": "impl_item", "name": null, "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": "Write comprehensive tests for the following Leptos function `get_server_fn_service`:\n\n```rust\npub fn get_server_fn_service...
test_generation
leptos
{ "type": "function_item", "name": "get_server_fn_service", "source_file": "server_fn/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": "Explain how `Suspend::new` works internally in Leptos's tachys layer. Cover: the role of the oneshot channel, why a separate ...
code_explanation
leptos
{ "type": "impl_item", "name": "Suspend", "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": "Explain how this hexagonal architecture pattern works in a Leptos server application, and why the trait implementation is in ...
code_explanation
leptos
{ "type": "impl_item", "name": "ExternalServiceTrait1", "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": "Show a full example using the `class` method from `ElementExt` to apply conditional and static CSS classes in Leptos:\n\n```r...
api_usage
leptos
{ "type": "function_item", "name": "class", "source_file": "tachys/src/html/element/element_ext.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 `NestedRouteViewState` pattern shown below as inspiration, implement a **new** related function or component...
code_generation
leptos
{ "type": "struct_item", "name": "NestedRouteViewState", "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": "Implement `InnerHtmlValue::hydrate` for a `Cow<'static, str>` type. The implementation should handle both `FROM_SERVER=true` ...
code_generation
leptos
{ "type": "function_item", "name": "hydrate", "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": "Implement a `FilteredSignal<T>` type that wraps a `MappedSignal<Vec<T>>` but only triggers subscribers when the filter condit...
code_generation
leptos
{ "type": "impl_item", "name": "Track", "source_file": "reactive_graph/src/signal/mapped.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 component for a complete shell/layout with `HydrationScripts`, `AutoReload`, and `<App/>` using the `pub fn...
code_generation
leptos
{ "type": "function_item", "name": "shell", "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": "Explain the `NextAttribute` trait in Leptos's `tachys` crate. What is its purpose in the static type system for HTML attribut...
code_explanation
leptos
{ "type": "impl_item", "name": "NextAttribute", "source_file": "tachys/src/view/static_types.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 `ServerFnError::fmt` implementation that serializes the error to its encoded string representation. Test ...
test_generation
leptos
{ "type": "function_item", "name": "fmt", "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": "Find the bug in the `view` function for ViewD that could cause a page layout issue when the async data is empty." }, { ...
bug_detection
leptos
{ "type": "function_item", "name": "view", "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 Leptos example that demonstrates chaining two async resources where the second depends on the first's resolved value...
code_generation
leptos
{ "type": "function_item", "name": "chain_await_resource", "source_file": "leptos/tests/pr_4061.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 `get_static_file` handler for a Leptos + Axum application that serves files from a `static/` directory, sets corr...
code_generation
leptos
{ "type": "function_item", "name": "get_static_file", "source_file": "projects/ory-kratos/server/src/fileserv.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 sequential Cucumber e2e test runner for a Leptos application that processes each `.feature` file one at a time to av...
code_generation
leptos
{ "type": "function_item", "name": "main", "source_file": "examples/regression/e2e/tests/app_suite.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 `ArcStore<T>` from `reactive_stores/src/lib.rs`. Cover creation, field access via `.read()` and...
test_generation
leptos
{ "type": "struct_item", "name": "ArcStore", "source_file": "reactive_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": "Explain this Leptos future wrapper:\n\n```rust\npub fn new(inner: Fut) -> Self {\n Self {\n hook: ERROR_HOOK.with_b...
code_explanation
leptos
{ "type": "function_item", "name": "new", "source_file": "any_error/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": "Show a practical, real-world usage example of the `Router` API from `router/src/components.rs` in a Leptos application. Inclu...
api_usage
leptos
{ "type": "function_item", "name": "Router", "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": "The `ReactiveRouterInnerState` struct in `router/src/reactive.rs` has the same trait bounds repeated across multiple impl blo...
refactoring
leptos
{ "type": "struct_item", "name": "ReactiveRouterInnerState", "source_file": "router/src/reactive.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 `MaybeSignal<T>` wrapper type for Leptos that can hold either a static `T` value or a reactive `Signal<T>`. Imple...
code_generation
leptos
{ "type": "impl_item", "name": "signal_wrapper", "source_file": "reactive_graph/src/wrappers.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 component using `generate_routes` to list all routes defined in a router for debugging or sitemap generatio...
code_generation
leptos
{ "type": "synthetic", "name": "generate_routes", "source_file": "router/src/matching/nested/tuples.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 `set_header` method alongside `append_header` for `ResponseOptions` in the leptos Axum integration that replaces a...
code_generation
leptos
{ "type": "generated", "name": "append_header", "source_file": "integrations/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": "Based on the Leptos codebase pattern shown below from `oco/src/lib.rs`, write a new, related but distinct function or compone...
code_generation
leptos
{ "type": "function_item", "name": "deref", "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": "Show a practical example of using `AsyncDerivedFuture` in Leptos. How does it allow awaiting a reactive derived value in an a...
api_usage
leptos
{ "type": "struct_item", "name": "AsyncDerivedFuture", "source_file": "reactive_graph/src/computed/async_derived/future_impls.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 `iter_unkeyed` semantics from `reactive_stores` to iterate over a store field containing a `Vec<S...
code_generation
leptos
{ "type": "function_item", "name": "iter_unkeyed", "source_file": "reactive_stores/src/iter.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 multipart codec in a Leptos server function that handles file uploads. Write a complete example with a `<...
code_generation
leptos
{ "type": "function_item", "name": "from_req", "source_file": "server_fn/src/codec/multipart.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 `mark_dirty` method on a reactive graph source. Why does it use `Weak::upgrade` and what happens if the upgrade f...
code_explanation
leptos
{ "type": "function_item", "name": "mark_dirty", "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": "Provide a deep technical explanation of the following Leptos/Rust code for `path_is`. Cover: what it does, how it works inter...
code_explanation
leptos
{ "type": "function_item", "name": "path_is", "source_file": "examples/regression/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": "Refactor the following `to_tokens` implementation from Leptos's view macro internals. The current code uses a `match` with tw...
refactoring
leptos
{ "type": "function_item", "name": "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": "Detect the bug in the `StreamBuilder::finish` method. Under what condition does the final sync buffer get dropped without bei...
bug_detection
leptos
{ "type": "function_item", "name": "finish", "source_file": "tachys/src/ssr/mod.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "The `ssr_modes_axum` example sets up an Axum server with custom COOP/COEP security headers injected in the fallback handler a...
refactoring
leptos
{ "type": "function", "name": "main", "source_file": "examples/ssr_modes_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": "Explain the `Write` trait implementation for `Subfield<Inner, Prev, T>` in `reactive_stores`. What does `try_write` return, h...
code_explanation
leptos
{ "type": "impl_item", "name": "Write", "source_file": "reactive_stores/src/subfield.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 integration utility sets HTTP cache-control headers:\n\n```rust\npub fn no_cache(res: &mut Response) {\n...
refactoring
leptos
{ "type": "integrations_source", "name": "no_cache", "source_file": "integrations/utils/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 use `NodeRef` with a Leptos element during SSR hydration? Show me a practical example of attaching a `NodeRef` to an...
api_usage
leptos
{ "type": "function_item", "name": "hydrate_node_ref", "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": "Show how to call `to_html_async_with_buf` on a custom Leptos HTML element implementation to produce streamed SSR output. Incl...
api_usage
leptos
{ "type": "function_item", "name": "to_html_async_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": "Explain the following leptos code in depth (`rebuild` from `tachys/src/html/style.rs`):\n\n```rust\nfn rebuild(\n self...
code_explanation
leptos
{ "type": "function_item", "name": "rebuild", "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": "Generate a `mount_to_body` convenience wrapper around `mount_to_renderer` that uses `document.body` as the mount target." }...
code_generation
leptos
{ "type": "generated", "name": "mount_to_renderer", "source_file": "leptos/src/mount.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 `insert_before_this` method for the `Mountable` impl of `ErrorBoundary` in `leptos/src/error_boundary.rs`. The ...
code_generation
leptos
{ "type": "impl_item", "name": "insert_before_this", "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": "Show a practical API usage of `add_any_attr` on `HtmlElement` in Leptos to dynamically attach attributes in a generic functio...
api_usage
leptos
{ "type": "synthetic", "name": "add_any_attr HtmlElement", "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": "Extend `fetch_api` to support authentication headers and retry on transient failures:\n\n```rust\npub async fn fetch_api<T>(p...
code_generation
leptos
{ "type": "function_item", "name": "fetch_api", "source_file": "examples/hackernews_axum/src/api.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "How does the `ToStream` blanket implementation in `reactive_graph` convert any Leptos signal into an async `Stream`? Walk thr...
code_generation
leptos
{ "type": "internal", "name": "ToStream for S", "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": "Explain how `InsideComponentChild` uses `Resource::new`, `Suspense`, and the `map` method on a resource to render async conte...
code_explanation
leptos
{ "type": "function_item", "name": "InsideComponentChild", "source_file": "examples/suspense_tests/src/instrumented.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 `projects/ory-kratos/app/src/auth/kratos_html.rs`, write a new, related...
code_generation
leptos
{ "type": "function_item", "name": "kratos_html", "source_file": "projects/ory-kratos/app/src/auth/kratos_html.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/view/any_view.rs`, write a new, related but distinct functi...
code_generation
leptos
{ "type": "function_item", "name": "insert_before_this", "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": "Show how to use the `into_req` method for PUT requests with URL-encoded form data in a server function codec." }, { "...
api_usage
leptos
{ "type": "function_item", "name": "into_req", "source_file": "server_fn/src/codec/url.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 `projects/ory-kratos/app/src/database_calls.rs`, write a new, related b...
code_generation
leptos
{ "type": "struct_item", "name": "PostPermissionRow", "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": "Write a `LazyRoute` implementation for a `BlogPost` route in a Leptos app that fetches post data and metadata, demonstrates t...
code_generation
leptos
{ "type": "impl_item", "name": "LazyRoute", "source_file": "examples/hackernews_axum/src/routes/story.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 is an implementation of `try_new_patch_streaming` from `server_fn/src/request/mod.rs`. Identify the bug, explai...
bug_detection
leptos
{ "type": "server_fn", "name": "try_new_patch_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 the following leptos code in depth (`new` from `reactive_graph/src/signal/trigger.rs`):\n\n```rust\npub fn new() -> S...
code_explanation
leptos
{ "type": "function_item", "name": "new", "source_file": "reactive_graph/src/signal/trigger.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 `try_new_post_form_data` on a mock request type in leptos's server_fn crate, verifying it constructs a POST r...
test_generation
leptos
{ "type": "function_item", "name": "try_new_post_form_data", "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": "Refactor the following Leptos Rust function `or_debug` to improve readability, reduce boilerplate, and follow idiomatic Rust/...
refactoring
leptos
{ "type": "function_item", "name": "or_debug", "source_file": "tachys/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 an implementation of `PropsOrNoPropsBuilder` for a Leptos component with optional props:\n\n```rust\nimpl<P: Props> ...
code_generation
leptos
{ "type": "impl_item", "name": "PropsOrNoPropsBuilder", "source_file": "leptos/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": "Show how to use the `xml-rs` crate's `EventWriter` to write a sitemap URL entry for a blog post. Include proper date formatti...
api_usage
leptos
{ "type": "function_item", "name": "write_post_entry", "source_file": "projects/sitemap_axum/src/sitemap.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 `Display` implementation for a `Url` struct. The code is supposed to format a URL string correctly from ...
bug_detection
leptos
{ "type": "impl_item", "name": "Display", "source_file": "router/src/location/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 `NodeType` (a virtual DOM representation) is used to build a simple HTML serializer that converts a `Node` tree to a...
code_generation
leptos
{ "type": "enum_item", "name": "NodeType", "source_file": "leptos/src/renderer/mock.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "Implement `FromStr` for a validated `EmailAddress` newtype that wraps a parsed email address. Use the `mailparse` / `addrpars...
code_generation
leptos
{ "type": "function_item", "name": "from_str", "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": "Create a Leptos component that uses `<ActionForm>` with a server function to submit a task title and priority level, then dis...
code_generation
leptos
{ "type": "function_item", "name": "FormExample", "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 how to use the `mount_to_body` function in a Leptos client-side app:\n\n```rust\npub fn main() {\n _ = console_log::i...
api_usage
leptos
{ "type": "function_item", "name": "main", "source_file": "examples/slots/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": "Identify the bug in this `SerializableData` impl for `SerdeJson` and explain when it would cause incorrect behavior:\n\n```ru...
bug_detection
leptos
{ "type": "synthetic", "name": "SerializableData SerdeJson", "source_file": "leptos_server/src/serializers.rs" }
[ { "role": "system", "content": "You are an expert Rust programmer specializing in the leptos crate and modern Rust development patterns." }, { "role": "user", "content": "In Leptos's tachys layer, event handlers like `On<E, F>` implement `ToTemplate` with an empty body. Explain why the `ToTempla...
code_generation
leptos
{ "type": "impl_item", "name": "ToTemplate", "source_file": "tachys/src/html/event.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 Leptos component that implements the `Mountable` trait for a text node, and show how `StrState` properly handles ins...
code_generation
leptos
{ "type": "impl_item", "name": "Mountable", "source_file": "tachys/src/view/strings.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 Leptos `FileWatcher` component that uses server-sent events (SSE) to stream file change notifications to the browser...
code_generation
leptos
{ "type": "function_item", "name": "FileWatcher", "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": "Implement a complete, working version of `TypedBuilderOpts` from `leptos_macro/src/slot.rs` with real logic:\n\n```rust\nstru...
code_generation
leptos
{ "type": "struct_item", "name": "TypedBuilderOpts", "source_file": "leptos_macro/src/slot.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 `Assignment` component that retrieves a `UserInfo` struct from context via `use_context::<UserInfo>()` and ren...
code_generation
leptos
{ "type": "function_item", "name": "Assignment", "source_file": "examples/regression/src/issue_4088.rs" }