Struct rocket::response::content::Content[][src]

pub struct Content<R>(pub ContentType, pub R);

Sets the Content-Type of a Responder to a chosen value.

Delagates the remainder of the response to the wrapped responder.


Set the Content-Type of a string to PDF.

use rocket::response::content::Content;
use rocket::http::ContentType;

let response = Content(ContentType::PDF, "Hi.");

Trait Implementations

impl<R: Debug> Debug for Content<R>

Formats the value using the given formatter. Read more

impl<R: Clone> Clone for Content<R>

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<R: PartialEq> PartialEq for Content<R>

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'r, R: Responder<'r>> Responder<'r> for Content<R>

Overrides the Content-Type of the response to the wrapped ContentType then delegates the remainder of the response to the wrapped responder.

Returns Ok if a Response could be generated successfully. Otherwise, returns an Err with a failing Status. Read more

Auto Trait Implementations

impl<R> Send for Content<R> where
    R: Send

impl<R> Sync for Content<R> where
    R: Sync