Rust

Web Frameworks

Actix-web, Axum, Rocket, routing, middleware, handlers, state management, JSON serialization

22 câu hỏi phỏng vấn·
Senior
1

Which Rust web framework is built directly on tokio and tower, favoring a modular trait-based approach?

Câu trả lời

Axum is built on tokio and tower, using tower's Service and Layer system for middleware. This architecture enables great composability and natural integration with the tower ecosystem (timeout, rate limiting, tracing). Axum leverages Rust traits for data extraction and type-safe handler management.

2

How to define a GET route with a path parameter in Axum?

Câu trả lời

In Axum, path parameters use the :param syntax in route definition, and are extracted via the Path<T> extractor. Type T must implement Deserialize, enabling type-safe extraction. The order of extractors in the handler signature determines how data is extracted from the request.

3

What is the distinctive feature of Actix-web's execution model compared to other Rust frameworks?

Câu trả lời

Actix-web uses the actor model where each worker is an independent actor with its own state. Requests are handled by actors communicating via asynchronous messages. This model provides excellent isolation and natural horizontal scalability, though the actor model is no longer mandatory in recent versions.

4

How to share application state between handlers in Axum?

5

What is Rocket's syntax for defining a route with automatic JSON body validation?

+19 câu hỏi phỏng vấn

Nắm vững Rust cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí