Skip to main content

Crate tower_embed

Crate tower_embed 

Source
Expand description

This crate provides a tower service designed to provide embedded static assets support for web application. This service includes the following HTTP features:

  • Support for GET and HEAD requests
  • Content-Type header generation based on file MIME type guessed from extension.
  • ETag header generation and validation.
  • Last-Modified header generation and validation.

In debug mode, assets are served directly from the filesystem to facilitate rapid development. Both ETag and Last-Modified headers are not generated in this mode.

§Usage

Please see the examples directory for a working example.

Modules§

core
Core functionalities of tower-embed.

Structs§

ResponseBody
The body used in crate responses.
ResponseFuture
Response future of ServeEmbed
ServeEmbed
Service that serves files from embedded assets.

Traits§

Embed
A trait used to access to binary assets in a directory.

Derive Macros§

Embed
Derive the Embed trait for unit struct, embedding assets from a folder.