Datasets:
messages list | category string | crate string | source dict |
|---|---|---|---|
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "I want to implement a custom extractor for a database connection in axum. How do I create a newtype wrapper that implements Fro... | code_generation | axum | {
"type": "function_item",
"name": "using_connection_extractor",
"source_file": "examples/tokio-redis/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Implement a dynamic fallback handler in an axum Router that serves explicit routes first (/api, /health) and then falls back to... | code_generation | axum | {
"type": "function_item",
"name": "using_serve_dir_only_from_root_via_fallback",
"source_file": "examples/static-file-server/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Refactor this messy axum code that manually converts request responses into a cleaner version using verified axum middleware pa... | refactoring | axum | {
"type": "trait_item",
"name": "IntoMapRequestResult",
"source_file": "axum/src/middleware/map_request.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I configure an axum MethodRouter to properly handle unsupported HTTP methods and return the correct status code with an ... | code_generation | axum | {
"type": "function_item",
"name": "empty_allow_header_by_default",
"source_file": "axum/src/routing/method_routing.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do you merge multiple HTTP method handlers in axum using the `.merge()` method? Provide a working example that demonstrates... | code_generation | axum | {
"type": "function_item",
"name": "merge",
"source_file": "axum/src/routing/method_routing.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How does the middleware extractor pattern work in axum, and when would I use a custom extractor as middleware?"
},
{
"r... | code_explanation | axum | {
"type": "function_item",
"name": "from_extractor_with_state",
"source_file": "axum/src/middleware/from_extractor.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Write comprehensive unit tests for an axum MethodRouter that handles GET and POST requests with different response codes and bo... | test_generation | axum | {
"type": "function_item",
"name": "on_service",
"source_file": "axum/src/routing/method_routing.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "What's a common mistake when setting up a Router with state? Here's buggy code that tries to serve an app: identify the bug and... | bug_detection | axum | {
"type": "impl_item",
"name": "Router",
"source_file": "axum/src/routing/mod.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I test Redirect responses in axum to verify that the correct status codes and Location headers are set?"
},
{
"r... | test_generation | axum | {
"type": "function_item",
"name": "test",
"source_file": "axum/src/response/redirect.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Write a web service that retrieves a user by ID from the path and returns JSON, using axum's router and extractors."
},
{
... | code_generation | axum | {
"type": "function_item",
"name": "typed_get",
"source_file": "axum-extra/src/routing/mod.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Write an axum handler that extracts a session token from request headers and uses it to load user context from application stat... | code_generation | axum | {
"type": "function_item",
"name": "from_request_parts",
"source_file": "axum-extra/src/extract/cookie/signed.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Create a custom extractor that consumes the raw request body, logs its size, and then makes it available to handlers. Implement... | code_generation | axum | {
"type": "impl_item",
"name": "BufferRequestBody",
"source_file": "examples/consume-body-in-extractor-or-middleware/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I extract the client's socket address in an axum handler and return it in the response? I need a complete working exampl... | code_generation | axum | {
"type": "function_item",
"name": "socket_addr",
"source_file": "axum/src/extract/connect_info.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Create a complete axum application with a custom extractor that validates JWT claims from the Authorization header and extracts... | code_generation | axum | {
"type": "impl_item",
"name": "User",
"source_file": "examples/oauth/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I serialize a Rust struct to JSON efficiently in an axum response handler without pre-allocating large buffers?"
},
... | code_generation | axum | {
"type": "function_item",
"name": "new",
"source_file": "axum-extra/src/response/erased_json.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Refactor this messy multipart file upload handler to follow clean patterns with proper error handling:\n\n```rust\nasync fn upl... | refactoring | axum | {
"type": "function_item",
"name": "handler",
"source_file": "axum-extra/src/extract/multipart.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How should I refactor this inline route handler into a cleaner pattern while still returning proper HTTP responses?"
},
{
... | refactoring | axum | {
"type": "function_item",
"name": "response",
"source_file": "axum-extra/src/response/file_stream.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I extract and work with raw form data in axum without parsing it into a struct?"
},
{
"role": "assistant",
"... | api_usage | axum | {
"type": "function_item",
"name": "check_body",
"source_file": "axum/src/extract/raw_form.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Explain how this code works and identify the axum APIs used:\n\n```rust\nimpl IntoResponseParts for CookieJar {\n type Error... | code_explanation | axum | {
"type": "impl_item",
"name": "IntoResponseParts",
"source_file": "axum-extra/src/extract/cookie/mod.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Generate ONE high-quality axum training pair INSPIRED BY this code chunk.\nFocus on the axum APIs and patterns shown, not the s... | bug_detection | axum | {
"type": "function_item",
"name": "supports_multiple_values",
"source_file": "axum-extra/src/extract/form.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I set up an axum application with logging middleware and state management? I want to bind to a socket and start serving ... | code_generation | axum | {
"type": "function_item",
"name": "main",
"source_file": "examples/reqwest-response/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I handle multipart form uploads in axum and process each field?"
},
{
"role": "assistant",
"content": "To ha... | api_usage | axum | {
"type": "function_item",
"name": "from_request",
"source_file": "axum/src/extract/multipart.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "What's the bug in this custom extractor implementation and how should I fix it?\n\n```rust\nasync fn from_request_parts(\n p... | bug_detection | axum | {
"type": "function_item",
"name": "from_request_parts",
"source_file": "examples/oauth/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I build a paginated API endpoint that accepts limit and offset query parameters and returns JSON?"
},
{
"role": ... | code_generation | axum | {
"type": "function_item",
"name": "handler",
"source_file": "axum/src/extract/query.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "I need to build a stateful axum application with shared AppState that holds a database pool and configuration. The router uses ... | code_generation | axum | {
"type": "function_item",
"name": "into_make_service",
"source_file": "axum/src/routing/mod.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "What does the `axum::body::to_bytes()` function do and how is it used in axum response handling?"
},
{
"role": "assista... | code_explanation | axum | {
"type": "function_item",
"name": "byte_from_response",
"source_file": "examples/compression/src/tests.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I accept JSON request bodies with nested struct fields in axum handlers while ensuring serde deserializes them correctly... | code_generation | axum | {
"type": "struct_item",
"name": "Bar",
"source_file": "axum-extra/src/extract/json_deserializer.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I extract and handle multipart file uploads in an axum handler? Show a complete example that receives multipart data and... | api_usage | axum | {
"type": "function_item",
"name": "bytes",
"source_file": "axum-extra/src/extract/multipart.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "I need to build a middleware that validates an HTTP request has a specific header with a required value. How do I extract the h... | code_generation | axum | {
"type": "function_item",
"name": "header_contains",
"source_file": "axum/src/extract/ws.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Refactor inline closures in axum route handlers to named async functions for better readability and reusability."
},
{
... | refactoring | axum | {
"type": "function_item",
"name": "main",
"source_file": "examples/readme/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "I have route handlers scattered across my codebase. How should I organize them into domain-specific router modules to keep the ... | refactoring | axum | {
"type": "function_item",
"name": "main",
"source_file": "axum/src/routing/mod.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Write a test that verifies a Router correctly dispatches requests to multiple route handlers based on the path."
},
{
"... | test_generation | axum | {
"type": "function_item",
"name": "test",
"source_file": "axum/src/routing/path_router.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do you extract and validate path parameters in axum? Show how to build an error handler that returns meaningful messages wh... | code_explanation | axum | {
"type": "function_item",
"name": "body_text",
"source_file": "axum/src/extract/path/mod.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "I have a multipart form handler that doesn't properly handle stream errors. Here's my code:\n\n```rust\nasync fn upload_file(mu... | bug_detection | axum | {
"type": "impl_item",
"name": "Stream",
"source_file": "axum-extra/src/extract/multipart.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "I have an axum application with multiple router modules that I want to organize more cleanly. What's the best way to structure ... | refactoring | axum | {
"type": "impl_item",
"name": "Clone",
"source_file": "axum/src/extract/connect_info.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I handle multipart form uploads in axum and extract the form data safely? I want to handle cases where the request paylo... | api_usage | axum | {
"type": "function_item",
"name": "body_text",
"source_file": "axum/src/extract/multipart.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I set up a WebSocket endpoint in axum and send messages to clients?"
},
{
"role": "assistant",
"content": "A... | api_usage | axum | {
"type": "function_item",
"name": "start_send",
"source_file": "axum/src/extract/ws.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do you initialize a custom extractor state in axum that holds an encrypted cookie jar and key? What pattern should I follow... | code_generation | axum | {
"type": "function_item",
"name": "new",
"source_file": "axum-extra/src/extract/cookie/private.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Here's a buggy axum middleware extractor that violates the body-last rule. Find the bug and fix it:\n\n```rust\nuse axum::{\n ... | bug_detection | axum | {
"type": "macro_definition",
"name": "impl_service",
"source_file": "axum/src/middleware/map_request.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I extract and validate typed headers in Axum? Show me how to extract custom headers with strong typing."
},
{
"r... | api_usage | axum | {
"type": "function_item",
"name": "handler",
"source_file": "axum/src/extract/mod.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Create a web form handler that accepts form data with file uploads and cookies. Implement an axum handler that:\n1. Extracts co... | code_generation | axum | {
"type": "function_item",
"name": "iter",
"source_file": "axum-extra/src/extract/cookie/private.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Explain how WebSocket message types are converted to binary data in axum's `Message` type. What does the pattern of matching on... | code_explanation | axum | {
"type": "function_item",
"name": "into_data",
"source_file": "axum/src/extract/ws.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Explain how axum routes handle different HTTP methods (GET, POST, PUT, DELETE) on the same path, and show an example of a route... | code_explanation | axum | {
"type": "function_item",
"name": "method_filter",
"source_file": "axum/src/routing/method_filter.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Explain how the `layer()` method and `into_service()` work together when building an axum application. Show how to add a layer ... | code_explanation | axum | {
"type": "function_item",
"name": "with_into_make_service_with_connect_info",
"source_file": "examples/testing/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Build an axum web service that validates API request paths before routing. Reject requests to / and /api/ with trailing slashes... | code_generation | axum | {
"type": "function_item",
"name": "validate_tsr_path",
"source_file": "axum-extra/src/routing/mod.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I create middleware using axum that modifies the request before it reaches the handler? For example, I need to add a cus... | code_generation | axum | {
"type": "function_item",
"name": "basic",
"source_file": "axum/src/middleware/from_fn.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Create a practical axum API that demonstrates how to compose routes with method-specific handlers. Build a simple task manageme... | code_generation | axum | {
"type": "impl_item",
"name": "Default",
"source_file": "axum/src/routing/method_routing.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Refactor the following axum code from axum/src/routing/tests/mod.rs to be cleaner and more idiomatic:\n\n```rust\nasync fn rout... | refactoring | axum | {
"type": "function_item",
"name": "router_type_doesnt_change",
"source_file": "axum/src/routing/tests/mod.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How does axum's `Json` extractor handle content-type validation? Explain the specific extractors, traits, and error handling in... | code_explanation | axum | {
"type": "function_item",
"name": "from_request",
"source_file": "axum/src/json.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Refactor this cookie handler to use cleaner response construction:\n\nBuggy code:\n```rust\nasync fn set_session() -> impl Into... | refactoring | axum | {
"type": "impl_item",
"name": "IntoResponseParts",
"source_file": "axum-extra/src/extract/cookie/private.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I convert a custom response body type into axum's Body in middleware? I'm wrapping a future that returns Response<Custom... | code_explanation | axum | {
"type": "impl_item",
"name": "Future",
"source_file": "axum/src/middleware/response_axum_body.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust developer specializing in the Axum web framework. Provide clear, working code examples using only verified Axum APIs."
},
{
"role": "user",
"content": "Write tests for axum routing — test that GET returns 200, POST returns correct JSON, unkn... | test_generation | axum | {
"type": "struct_item",
"name": "Part",
"source_file": "axum-extra/src/response/multiple.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I build a user registration API endpoint that accepts form data with validation in Axum?"
},
{
"role": "assistan... | code_generation | axum | {
"type": "function_item",
"name": "handler",
"source_file": "axum/src/extract/form.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Write a test for axum middleware that uses cloning and state management patterns. Create a #[test] function that verifies middl... | test_generation | axum | {
"type": "function_item",
"name": "clone",
"source_file": "axum/src/middleware/from_fn.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I create a custom multipart response in axum that constructs a Content-Type header with a boundary and serializes multip... | code_generation | axum | {
"type": "function_item",
"name": "into_response",
"source_file": "axum-extra/src/response/multiple.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "I have copy-pasted auth checks in multiple handlers. How do I refactor this into a reusable FromRequestParts extractor?"
},
... | refactoring | axum | {
"type": "function_item",
"name": "handler",
"source_file": "examples/jwt/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Refactor messy axum code: I have handlers with scattered error handling using Results and plain strings. Refactor this to use p... | refactoring | axum | {
"type": "impl_item",
"name": "AppError",
"source_file": "examples/anyhow-error-response/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Build a REST API router in axum that handles GET, POST, PUT, and DELETE requests to /items/{id}. Each method should return diff... | code_generation | axum | {
"type": "function_item",
"name": "try_from",
"source_file": "axum/src/routing/method_filter.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do you nest route handlers and apply fallback services in axum for organizing routes?"
},
{
"role": "assistant",
... | code_generation | axum | {
"type": "function_item",
"name": "using_serve_dir_with_assets_fallback",
"source_file": "examples/static-file-server/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I extract the matched path from a request in axum? I want to access the route pattern that matched the incoming request,... | code_generation | axum | {
"type": "impl_item",
"name": "MatchedPath",
"source_file": "axum/src/extract/matched_path.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Write tests for a custom IntoResponse implementation that converts custom error types to HTTP responses."
},
{
"role": ... | test_generation | axum | {
"type": "function_item",
"name": "test",
"source_file": "examples/error-handling/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "I have a bug where I defined two GET handlers for the same route. What's the issue and how do I fix it?"
},
{
"role": "... | bug_detection | axum | {
"type": "function_item",
"name": "set_endpoint",
"source_file": "axum/src/routing/method_routing.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are a Rust expert teaching axum web framework patterns and bug detection."
},
{
"role": "user",
"content": "What's wrong with this axum middleware setup and how do I fix it?"
},
{
"role": "assistant",
"content": "The bug is incorrect middleware lay... | bug_detection | axum | {
"type": "function_item",
"name": "app",
"source_file": "examples/compression/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Explain how axum's Router and handler composition works. What does .route() do, and how do method extractors like get() fit int... | code_explanation | axum | {
"type": "function_item",
"name": "server",
"source_file": "examples/unix-domain-socket/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Create a buggy version of axum cookie handling. Show a REAL API misuse involving cookies extracted via CookieJar, then provide ... | bug_detection | axum | {
"type": "macro_definition",
"name": "cookie_test",
"source_file": "axum-extra/src/extract/cookie/mod.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "I need to build a file upload handler that accepts multipart form data with multiple files. I'm using the `Multipart` extractor... | code_generation | axum | {
"type": "impl_item",
"name": "Multipart",
"source_file": "axum/src/extract/multipart.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I implement a WebSocket upgrade handler in axum that properly converts the upgrade to a response without test utilities?... | api_usage | axum | {
"type": "function_item",
"name": "default_on_failed_upgrade",
"source_file": "axum/src/extract/ws.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do type conversions and the From trait work in axum extractors? Explain the pattern shown in the Utf8Bytes to Bytes convers... | code_explanation | axum | {
"type": "impl_item",
"name": "Bytes",
"source_file": "axum/src/extract/ws.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I write tests for axum middleware that modifies requests and responses?"
},
{
"role": "assistant",
"content"... | test_generation | axum | {
"type": "function_item",
"name": "test",
"source_file": "axum/src/middleware/map_response.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I serve static HTML pages in axum using the Html response type?"
},
{
"role": "assistant",
"content": "Use t... | api_usage | axum | {
"type": "function_item",
"name": "main",
"source_file": "examples/templates/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "I need to create an axum handler that validates JSON requests by checking the Content-Type header before processing the JSON bo... | code_generation | axum | {
"type": "function_item",
"name": "valid_json_content_type",
"source_file": "axum/src/json.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Explain how nested routing works with Router::nest() and merge() in axum."
},
{
"role": "assistant",
"content": "``... | code_explanation | axum | {
"type": "function_item",
"name": "handler",
"source_file": "axum-extra/src/routing/mod.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Write a test for an axum middleware that extracts an authenticated user and rejects requests without valid credentials. Use rea... | test_generation | axum | {
"type": "function_item",
"name": "poll",
"source_file": "axum/src/middleware/from_extractor.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "I have a handler that doesn't properly implement IntoResponse. What's the issue and how do I fix it?\n\nBuggy code:\n```rust\na... | bug_detection | axum | {
"type": "function_item",
"name": "handler",
"source_file": "axum/src/response/mod.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I serve a file from the filesystem in an Axum handler? Create a handler that opens a file, extracts its metadata (size, ... | code_generation | axum | {
"type": "function_item",
"name": "from_path",
"source_file": "axum-extra/src/response/file_stream.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "I'm building a response handler that needs to return multiple file streams in a single response. How would I construct a bounda... | code_generation | axum | {
"type": "function_item",
"name": "generate_boundary",
"source_file": "axum-extra/src/response/multiple.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Write unit tests for the `zip_longest` function that verify it correctly pairs elements and handles iterators of different leng... | test_generation | axum | {
"type": "function_item",
"name": "zip_longest",
"source_file": "axum/src/routing/strip_prefix.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I set up WebSocket handlers in axum? Show me a simple echo WebSocket server."
},
{
"role": "assistant",
"con... | api_usage | axum | {
"type": "function_item",
"name": "on_upgrade",
"source_file": "axum/src/extract/ws.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "I need to build an API endpoint that returns different status codes and response bodies based on conditions. How should I prope... | refactoring | axum | {
"type": "function_item",
"name": "doenst_override_status_code_when_using_into_response_failed_at_same_level",
"source_file": "axum/src/response/mod.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I extract and validate form data in axum? Show me how to handle URL-encoded form submissions with GET and POST requests.... | code_generation | axum | {
"type": "impl_item",
"name": "RawForm",
"source_file": "axum/src/extract/raw_form.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I apply a layer to an axum router to transform requests?"
},
{
"role": "assistant",
"content": "You apply la... | api_usage | axum | {
"type": "function_item",
"name": "layer",
"source_file": "axum/src/middleware/map_request.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Explain how to implement the `From<CustomError> for AppError` pattern in axum for custom error handling."
},
{
"role": ... | code_explanation | axum | {
"type": "impl_item",
"name": "AppError",
"source_file": "examples/error-handling/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "This serve function sets up a TCP listener and adds tracing middleware manually. I see some unnecessary duplication here. How w... | refactoring | axum | {
"type": "function_item",
"name": "serve",
"source_file": "examples/static-file-server/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Write a From<JsonRejection> implementation for a custom error enum that wraps different extraction rejection types. Show how to... | code_generation | axum | {
"type": "impl_item",
"name": "AppError",
"source_file": "examples/error-handling/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "What's the bug in this custom extractor's error handling? It returns () as the rejection type instead of a proper IntoResponse.... | bug_detection | axum | {
"type": "function_item",
"name": "from_request_parts",
"source_file": "axum-extra/src/extract/with_rejection.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How does multipart form data extraction work in axum? Explain the key APIs involved."
},
{
"role": "assistant",
"co... | code_explanation | axum | {
"type": "function_item",
"name": "is_body_limit_error",
"source_file": "axum-extra/src/extract/multipart.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I set HTTP response cookies in axum? I need to send Set-Cookie headers in my response."
},
{
"role": "assistant"... | api_usage | axum | {
"type": "function_item",
"name": "set_cookies",
"source_file": "axum-extra/src/extract/cookie/mod.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "I have buggy middleware that forwards requests but doesn't call next. What's the problem and how do I fix it?"
},
{
"ro... | bug_detection | axum | {
"type": "function_item",
"name": "middleware",
"source_file": "axum/src/middleware/map_request.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Build an axum form validation system that captures validation errors and returns them as HTTP responses. Show how to implement ... | code_generation | axum | {
"type": "enum_item",
"name": "ServerError",
"source_file": "examples/validator/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I handle struct deserialization in axum request handlers when dealing with optional fields?"
},
{
"role": "assis... | api_usage | axum | {
"type": "struct_item",
"name": "User",
"source_file": "examples/diesel-async-postgres/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I build a user profile API with GET and PUT endpoints that accept Path parameters for user IDs and JSON request/response... | code_generation | axum | {
"type": "function_item",
"name": "handler",
"source_file": "axum/src/extract/json.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Build an Axum handler that accepts a query parameter, validates its length (must be at least 3 characters), and returns a BAD_R... | code_generation | axum | {
"type": "function_item",
"name": "test_with_param_with_short_value",
"source_file": "examples/validator/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Create a REST API endpoint that returns different HTTP method support information via the Allow header. Build a router with GET... | code_generation | axum | {
"type": "enum_item",
"name": "AllowHeader",
"source_file": "axum/src/routing/method_routing.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "Explain how custom extractors implement the `FromRequestParts` trait to parse query strings. What's happening in this code that... | code_explanation | axum | {
"type": "function_item",
"name": "from_request_parts",
"source_file": "axum-extra/src/extract/query.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust developer helping with Axum web framework questions. Provide complete, working code with proper imports."
},
{
"role": "user",
"content": "How do I set up an Axum web server with WebSocket support, tracing/logging, and serve static files fro... | api_usage | axum | {
"type": "unknown",
"name": "",
"source_file": "examples/websockets/src/main.rs",
"pattern": null
} |
[
{
"role": "system",
"content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."
},
{
"role": "user",
"content": "How do I implement a custom extractor for my axum application that pulls database connections from shared application state?"
... | code_generation | axum | {
"type": "impl_item",
"name": "DatabaseConnection",
"source_file": "examples/sqlx-postgres/src/main.rs",
"pattern": null
} |
End of preview. Expand in Data Studio
Arcwright-Axum
An instruction-tuning dataset for the Axum Rust crate, built for the Arcwright fine-tuned model.
Axum is a web application framework built on top of Tokio and Tower, focused on ergonomics and modularity.
Dataset Summary
- 741 instruction-response pairs covering http routing, middleware, extractors (path, query, json, state), error handling, tower layers, and websocket support
- Generated from real source code using the OSS-Instruct methodology via Claude Code sub-agents
- Validated for structural correctness and deduplicated using MinHash (Jaccard threshold 0.7)
- Format: ChatML (messages array with system/user/assistant roles)
Category Distribution
| Category | Count | % |
|---|---|---|
| Code Generation | 233 | 31% |
| Code Explanation | 141 | 19% |
| Api Usage | 138 | 18% |
| Bug Detection | 72 | 9% |
| Refactoring | 83 | 11% |
| Test Generation | 74 | 9% |
Format
Each example is a JSON object with a messages array:
{
"messages": [
{"role": "system", "content": "You are an expert Rust programmer specializing in the axum crate and modern Rust development patterns."},
{"role": "user", "content": "Write an Axum web server with a POST /users endpoint that accepts JSON input, validates it, and returns a created user with a generated ID."},
{"role": "assistant", "content": "..."}
],
"category": "code_generation",
"crate": "axum"
}
Usage
from datasets import load_dataset
dataset = load_dataset("y0sif/Arcwright-Axum")
print(dataset["train"][0]["messages"])
Part of Arcwright
This dataset is one of three crate-specific datasets used to train Arcwright-E4B-v1:
| Dataset | Crate | Pairs |
|---|---|---|
| Arcwright-Leptos | Leptos | 2,046 |
| Arcwright-Axum | Axum | 741 |
| Arcwright-Rig | Rig | 697 |
Source
All instruction pairs were generated from source code in the Axum repository. Code was chunked using tree-sitter into meaningful units (functions, impl blocks, modules), then used as seed material for instruction generation.
License
Apache 2.0
- Downloads last month
- 47