pub struct ContentResult { /* private fields */ }Expand description
A body sent as-is with an explicit media type — ASP.NET Core’s
ContentResult (Content(...), Text(...), Results.Bytes(...)).
Implementations§
Source§impl ContentResult
impl ContentResult
Sourcepub fn bytes(body: impl Into<Vec<u8>>, content_type: impl Into<String>) -> Self
pub fn bytes(body: impl Into<Vec<u8>>, content_type: impl Into<String>) -> Self
Raw bytes with an explicit media type.
Sourcepub fn content_type(self, content_type: impl Into<String>) -> Self
pub fn content_type(self, content_type: impl Into<String>) -> Self
Override the media type (e.g. text/csv; charset=utf-8).
Sourcepub fn header(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add a response header.
Sourcepub fn download_name(self, file_name: impl Into<String>) -> Self
pub fn download_name(self, file_name: impl Into<String>) -> Self
Send the body as a download named file_name
(Content-Disposition: attachment).
Sourcepub fn inline_name(self, file_name: impl Into<String>) -> Self
pub fn inline_name(self, file_name: impl Into<String>) -> Self
Send the body inline under file_name
(Content-Disposition: inline).
Trait Implementations§
Source§impl IActionResult for ContentResult
impl IActionResult for ContentResult
Auto Trait Implementations§
impl Forget for ContentResult
impl Freeze for ContentResult
impl Move for ContentResult
impl RefUnwindSafe for ContentResult
impl Send for ContentResult
impl Sync for ContentResult
impl Unpin for ContentResult
impl UnsafeUnpin for ContentResult
impl UnwindSafe for ContentResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more