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 have a WebSocket upgrade handler that needs to accept optional protocol hints from the client and validate them against suppo...
code_generation
axum
{ "type": "function_item", "name": "protocols", "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 extract and use custom connection information from incoming requests in axum?" }, { "role": "assistant", "...
code_generation
axum
{ "type": "function_item", "name": "custom", "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": "I need to create a router that returns METHOD_NOT_ALLOWED for unsupported HTTP methods. How do I use fallback() and method rout...
code_generation
axum
{ "type": "function_item", "name": "allow_header_with_fallback", "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 this error handler to return JSON instead of plain text, keeping the 500 status code. The original handler returns `(S...
refactoring
axum
{ "type": "impl_item", "name": "IntoResponse", "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": "I found a subtle bug in this axum test code. The request is created with `http::Request::post()` but then passed to `app().ones...
bug_detection
axum
{ "type": "function_item", "name": "handle_uncompressed_request_bodies", "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": "Build a type-safe REST API with path parameters that uses custom extractors and implements IntoResponse." }, { "role": ...
code_generation
axum
{ "type": "function_item", "name": "handler", "source_file": "axum-extra/src/routing/typed.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 handle WebSocket messages in Axum, including text, binary, and close frames?" }, { "r...
code_generation
axum
{ "type": "unknown", "name": "", "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": "Create a REST API handler that extracts multiple path parameters (user ID and post ID) using axum's Path extractor, validates t...
code_generation
axum
{ "type": "function_item", "name": "handler", "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": "How do I build a file upload handler in axum that processes multipart form data and extracts file metadata like filename and co...
code_generation
axum
{ "type": "function_item", "name": "content_type_with_encoding", "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": "Write a simple REST API with multiple routes that responds with JSON. Include GET endpoints for listing items and POST for crea...
code_generation
axum
{ "type": "function_item", "name": "main", "source_file": "examples/hello-world/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 does extracting JSON request bodies work in axum handlers, and what role do the State and Json extractors play in creating ...
code_explanation
axum
{ "type": "function_item", "name": "create_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": "Write tests that verify how axum handlers respond with different status codes and error bodies using tuples and IntoResponse." ...
test_generation
axum
{ "type": "function_item", "name": "into_response", "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": "Write unit tests for the Json extractor covering valid body parsing, invalid JSON, and missing Content-Type header scenarios." ...
test_generation
axum
{ "type": "function_item", "name": "test", "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": "How do I implement FromRef to extract a custom state type from my AppState in axum route handlers?" }, { "role": "assis...
code_generation
axum
{ "type": "impl_item", "name": "MemoryStore", "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 create a router that handles GET, POST, and PUT requests to different handlers based on the HTTP method?" }, { ...
api_usage
axum
{ "type": "macro_definition", "name": "call", "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": "I need to build a search endpoint where query parameters are optional. How do I handle missing search terms gracefully?" }, ...
code_generation
axum
{ "type": "function_item", "name": "test_try_from_uri_with_invalid_query", "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": "Refactor a deeply nested Router with many routes into a cleaner structure using nest() for API grouping. Show how to organize /...
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": "How do I handle multipart form uploads with optional data in axum, checking if the multipart is present before processing field...
code_generation
axum
{ "type": "function_item", "name": "handle", "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 extract and iterate over multiple path parameters in an axum handler? Show a complete example with a route like /users...
api_usage
axum
{ "type": "impl_item", "name": "IntoIterator", "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": "How do I return different HTTP status codes with JSON responses in axum?" }, { "role": "assistant", "content": "In ...
api_usage
axum
{ "type": "function_item", "name": "status_code_tuple_doesnt_override_error_json", "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": "Write an axum handler that receives multipart form data with file uploads. Process each field in the multipart request, extract...
code_generation
axum
{ "type": "impl_item", "name": "Field", "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 implement request validation middleware that checks for required headers before processing requests?" }, { "ro...
api_usage
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": "How can I write custom middleware in axum that modifies request headers before they reach my handler? I need to add a custom he...
api_usage
axum
{ "type": "function_item", "name": "insert_header", "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": "Review this axum code from axum-macros/src/typed_path.rs and identify potential bugs or issues:\n\n```rust\nfn simple_pluralize...
bug_detection
axum
{ "type": "function_item", "name": "simple_pluralize", "source_file": "axum-macros/src/typed_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": "I need to build an axum handler that extracts connection info from the request and returns it as JSON. How would I create a rou...
code_generation
axum
{ "type": "function_item", "name": "connect_info", "source_file": "examples/unix-domain-socket/src/main.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": "Show a complete example of handling different HTTP methods (GET, POST, PUT, DELETE) for RESTful endpoi...
api_usage
axum
{ "type": "unknown", "name": "", "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 I validate the Content-Type header before deserializing JSON in axum?" }, { "role": "assistant", "content": ...
api_usage
axum
{ "type": "function_item", "name": "consume_body_to_json_requires_json_content_type", "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": "Write tests that verify middleware layers execute in the correct order. Ensure layer ordering affects request/response flow." ...
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": "Write a test for an Axum endpoint that handles query parameters with optional fields." }, { "role": "assistant", "c...
test_generation
axum
{ "type": "function_item", "name": "test_query", "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 have a handler that manipulates HTTP headers directly using match statements and Option checks. The code is verbose and hard ...
refactoring
axum
{ "type": "function_item", "name": "set_allow_header", "source_file": "axum/src/routing/route.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 complete axum handler that streams Server-Sent Events (SSE) to a client, demonstrating how to return a streaming respon...
code_generation
axum
{ "type": "function_item", "name": "write_buf", "source_file": "axum/src/response/sse.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 returns &str but I'm getting lifetime errors. How do I fix this in axum?" }, { "role": "assistant...
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": "Design an axum application that uses Router::merge() to combine multiple routers for different API domains (users, products, he...
code_generation
axum
{ "type": "function_item", "name": "merge", "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 extract and validate signed cookies from request headers in axum? I need to verify the signature and ensure tampering ...
code_generation
axum
{ "type": "impl_item", "name": "SignedCookieJar", "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": "Write tests for a response middleware that modifies response headers and body. Show how to test that the middleware correctly t...
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": "Build me a complete API endpoint that requires bearer token authentication. The client must send an Authorization header, and i...
code_generation
axum
{ "type": "impl_item", "name": "RequireAuth", "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": "How do I handle streaming data like WebSocket messages in axum with testable logic?" }, { "role": "assistant", "con...
code_explanation
axum
{ "type": "function_item", "name": "unit_testable_handle_socket", "source_file": "examples/testing-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": "Write Rust code to implement all_the_tuples_no_last_special_case." }, { "role": "assistant", "content": "Here's a a...
code_generation
axum
{ "type": "macro_definition", "name": "all_the_tuples_no_last_special_case", "source_file": "axum-core/src/macros.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 axum Redirect responses. Test permanent redirects, temporary redirects, and redirect_to()." }, { "role"...
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": "How do I create a helper function that dynamically constructs REST resource routes with different HTTP methods? I want to build...
code_generation
axum
{ "type": "function_item", "name": "edit", "source_file": "axum-extra/src/routing/resource.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 the different Redirect response types in axum and when to use each one." }, { "role": "assistant", "content...
code_explanation
axum
{ "type": "function_item", "name": "redirect", "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 an axum endpoint that updates a database record from a JSON request body. The endpoint should accept state (database conn...
code_generation
axum
{ "type": "function_item", "name": "update_member", "source_file": "examples/mongodb/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 to use the State extractor to share application data with axum handlers. Show how State<S> works as a FromRequestPa...
code_explanation
axum
{ "type": "impl_item", "name": "Keys", "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": "Show me a buggy version of axum fallback handling. I want to see the mistake and understand the correct way to define fallback ...
bug_detection
axum
{ "type": "function_item", "name": "fallback_endpoint", "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": "I'm doing string-based path matching in my handler. How should I use MatchedPath extractor instead?" }, { "role": "assi...
refactoring
axum
{ "type": "function_item", "name": "handler", "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": "I need to build a strongly-typed URL builder in axum that generates links with query parameters. I know about `TypedPath` for d...
code_generation
axum
{ "type": "impl_item", "name": "TypedPath", "source_file": "axum-extra/src/routing/typed.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 refactor request extraction code. I have a handler that uses `from_request_parts` to pull an extension from the reque...
refactoring
axum
{ "type": "function_item", "name": "from_request_parts", "source_file": "axum/src/extract/nested_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": "How do I extract query string parameters from the request URI in axum?" }, { "role": "assistant", "content": "You c...
api_usage
axum
{ "type": "impl_item", "name": "RawQuery", "source_file": "axum/src/extract/raw_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": "How do I implement custom error handling in axum with a structured AppError type that implements IntoResponse?" }, { "r...
refactoring
axum
{ "type": "function_item", "name": "handler", "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": "Show me how to build a multipart form handler in axum that accepts file uploads and returns different content types based on th...
code_generation
axum
{ "type": "function_item", "name": "handler", "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 create a custom response type that handles file attachments with proper Content-Disposition headers, including filenam...
api_usage
axum
{ "type": "function_item", "name": "attachment_filename_escapes_backslashes", "source_file": "axum-extra/src/response/attachment.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 an API router with middleware for request validation. Show me how to create a MethodRouter that applies a custom m...
api_usage
axum
{ "type": "function_item", "name": "layer", "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 middleware::from_fn_with_state() passes application state to middleware functions." }, { "role": "assistant...
code_explanation
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": "I have this WebSocket message handling code that's pretty clunky. How would you refactor it using better axum patterns?\n\n```r...
refactoring
axum
{ "type": "impl_item", "name": "Message", "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 extract individual field data from a multipart form submission and validate the field properties?" }, { "role"...
api_usage
axum
{ "type": "function_item", "name": "accept_form", "source_file": "examples/stream-to-file/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 is the purpose of the JsonDeserializer extractor in axum-extra, and how do you use it to deserialize JSON request bodies w...
code_explanation
axum
{ "type": "function_item", "name": "handler", "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": "Explain how axum handlers return impl IntoResponse and what types satisfy this trait. Provide examples of different response ty...
code_explanation
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": "What are the key differences between `FromRequest` and `FromRequestParts` in Axum extractors?" }, { "role": "assistant"...
code_explanation
axum
{ "type": "struct_item", "name": "FileStream", "source_file": "axum-extra/src/response/file_stream.rs", "pattern": null }
[ { "role": "system", "content": "You are an expert Rust developer helping with axum web framework questions." }, { "role": "user", "content": "Explain how axum response types work, especially IntoResponse trait, tuple responses, and content types." }, { "role": "assistant", "content":...
code_explanation
axum
{ "type": "impl_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 custom JSON request/response pipeline in axum with automatic type conversion?" }, { "role": "assistant...
code_generation
axum
{ "type": "impl_item", "name": "Utf8Bytes", "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 have a bug in my axum form handler. The code below should accept form data via POST, deserialize it into a LoginRequest struc...
bug_detection
axum
{ "type": "function_item", "name": "deserialize_error_status_codes", "source_file": "axum/src/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": "Build a complete axum server that listens on localhost:8080, defines two routes (GET /hello and POST /data), and uses axum::ser...
code_generation
axum
{ "type": "function_item", "name": "serve", "source_file": "examples/cors/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 simple REST API endpoint in axum that handles multiple HTTP methods (GET, POST, PUT, DELETE) on the same resou...
api_usage
axum
{ "type": "function_item", "name": "works", "source_file": "axum-extra/src/routing/resource.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 `Router::with_state()` works and when to use it in a middleware or service builder context." }, { "role": "...
code_explanation
axum
{ "type": "function_item", "name": "call", "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": "Create a handler that builds a query string for database filtering. The handler should accept filter parameters (name, status, ...
code_generation
axum
{ "type": "function_item", "name": "with_query_params", "source_file": "axum-extra/src/routing/typed.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 deserialize path parameters in an axum route handler? Show a complete example with proper error handling."...
api_usage
axum
{ "type": "impl_item", "name": "FailedToDeserializePathParams", "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": "What does this code pattern accomplish and which axum traits are being used?" }, { "role": "assistant", "content": ...
code_explanation
axum
{ "type": "function_item", "name": "new", "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": "I'm building a REST API with axum where I need to define routes for creating resources. How should I test that POST requests to...
test_generation
axum
{ "type": "function_item", "name": "create", "source_file": "axum-extra/src/routing/resource.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 REST API router that handles different HTTP methods (GET, POST, PUT, DELETE) on the same path, with different...
code_generation
axum
{ "type": "function_item", "name": "call_with_state", "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": "Create an async HTTP server that binds to a port, defines multiple routes with different HTTP methods, and returns JSON respons...
code_generation
axum
{ "type": "function_item", "name": "main", "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": "I have a handler that returns different response types (Json, Html, StatusCode). How do I refactor it to use IntoResponse?" }...
refactoring
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": "I found this buggy code in my axum handler. What's wrong and how do I fix it?\n\n```rust\nuse axum::{routing::post, Router, ext...
bug_detection
axum
{ "type": "function_item", "name": "body_text", "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": "Create a handler that returns a tuple response combining headers, extensions, and a response body. The response should set a cu...
code_generation
axum
{ "type": "function_item", "name": "header_array_extension_body", "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": "Write a custom error handler for axum that responds with JSON when a path parameter contains invalid UTF-8. How should you stru...
code_generation
axum
{ "type": "impl_item", "name": "InvalidUtf8InPathParam", "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": "How do I accept form data in an axum handler and return a proper response with the correct Content-Type header?" }, { "...
api_usage
axum
{ "type": "function_item", "name": "make_response", "source_file": "axum/src/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": "I need to build a middleware that validates incoming JSON requests before they reach handlers. The middleware should extract re...
code_generation
axum
{ "type": "impl_item", "name": "Future", "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": "How do I handle multipart form data with file uploads in an axum handler? What extractors and types should I use?" }, { ...
code_explanation
axum
{ "type": "function_item", "name": "file", "source_file": "axum-extra/src/response/multiple.rs", "pattern": null }
[ { "role": "system", "content": "You are an expert Rust developer helping with axum web framework questions." }, { "role": "user", "content": "How do I create middleware that modifies requests in axum?" }, { "role": "assistant", "content": "In axum, you can create request-modifying mi...
api_usage
axum
{ "type": "function_item", "name": "clone", "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 handle Server-Sent Events (SSE) with streaming responses in Axum? I need to send multiple events from a handler." },...
api_usage
axum
{ "type": "impl_item", "name": "Buffer", "source_file": "axum/src/response/sse.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": "Review this axum code from axum/src/extract/connect_info.rs and identify potential bugs or issues:\n\n```rust\nimpl<S, C, T> Se...
bug_detection
axum
{ "type": "impl_item", "name": null, "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 does axum's `MethodRouter` struct handle HTTP method dispatch, and what role do extractors play in routing decisions?" },...
code_explanation
axum
{ "type": "struct_item", "name": "MethodRouter", "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": "I have a handler that returns raw tuples like `(StatusCode::OK, \"response\")`. How do I refactor this to use a custom typed re...
refactoring
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 extract multiple path parameters as a struct instead of a tuple in axum? What's the best way to handle path parsing er...
api_usage
axum
{ "type": "impl_item", "name": "ErrorKind_Display", "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": "How do I create a custom middleware layer for axum that extracts and validates request headers before passing the request to ha...
api_usage
axum
{ "type": "struct_item", "name": "MapRequestLayer", "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 set up a basic axum server with a TCP listener and create a simple router to handle GET requests?" }, { "role"...
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": "How do I implement a custom error response handler in axum that returns different HTTP status codes based on the error type? Sh...
code_generation
axum
{ "type": "function_item", "name": "into_response", "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 this query string extraction code to use axum extractors properly:\n\n```rust\npub fn try_from_uri(value: &Uri) -> Res...
refactoring
axum
{ "type": "function_item", "name": "try_from_uri", "source_file": "axum-extra/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": "How do I use MatchedPath in axum to capture and inspect the matched route pattern in a handler?" }, { "role": "assistan...
api_usage
axum
{ "type": "function_item", "name": "matching_asterisk", "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": "How do I handle HTTP methods that aren't explicitly defined in my axum router? I want to respond with a fallback handler for un...
code_generation
axum
{ "type": "function_item", "name": "allow_header_any", "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": "Can you explain how axum's middleware extractor pattern works? Specifically, how does the `FromRequestParts` trait get invoked ...
code_explanation
axum
{ "type": "function_item", "name": "call", "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": "Explain how the Html response type works in axum and why you would use it instead of String for returning HTML content from a h...
code_explanation
axum
{ "type": "function_item", "name": "show_form", "source_file": "examples/form/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 this SSE (Server-Sent Events) code that uses axum's Event and RawValue handling. Can you show me a cleaner way to build ...
refactoring
axum
{ "type": "function_item", "name": "valid_json_raw_value_chars_handled", "source_file": "axum/src/response/sse.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": "Show how to handle multipart file uploads in axum. I need to receive multiple files and process each one." }, { "role":...
code_generation
axum
{ "type": "function_item", "name": "next_field", "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": "Create an axum error handler that catches any application error and returns a JSON error response. The handler should log the e...
code_generation
axum
{ "type": "function_item", "name": "into_response", "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 implement custom error handling for extractors in axum? I need to wrap extraction errors and provide detailed error in...
code_generation
axum
{ "type": "function_item", "name": "fmt", "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": "What's wrong with this handler that extracts JWT claims and returns protected data?\n\nBuggy code:\n```rust\nasync fn protected...
bug_detection
axum
{ "type": "function_item", "name": "protected", "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": "Create a router with three endpoints: GET /health returns a plain text OK, POST /users accepts JSON with a name field and retur...
code_generation
axum
{ "type": "function_item", "name": "main_app", "source_file": "examples/prometheus-metrics/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 the MethodRouter struct works in axum and what each HTTP method field represents." }, { "role": "assistant"...
code_explanation
axum
{ "type": "function_item", "name": "MethodRouter", "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": "Can you explain what the `route()` method does in axum and how it combines with method routers like `get()` and `post()`?" },...
code_explanation
axum
{ "type": "function_item", "name": "route", "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": "Create a complete axum application that uses Router.with_state() to attach application state (like a database connection or con...
code_generation
axum
{ "type": "function_item", "name": "with_state", "source_file": "axum/src/routing/mod.rs", "pattern": null }