Rust

Web Frameworks

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

22 perguntas de entrevistaยท
Senior
1

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

Resposta

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?

Resposta

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?

Resposta

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 perguntas de entrevista

Domine Rust para sua proxima entrevista

Acesse todas as perguntas, flashcards, testes tecnicos, exercicios de code review e simuladores de entrevista.

Comece gratis