pub enum Disposition {
Inline,
Download,
}Expand description
Tells serve whether the browser shows a file or downloads it.
Either way Content-Disposition carries the original file name (ASCII in
filename=, UTF-8 in filename*= when needed, RFC 6266).
§Examples
use ocre::storage::Disposition;
// A download link: `?download=1` forces the "Save as" dialog.
let download = true;
let disposition = if download { Disposition::Download } else { Disposition::Inline };
assert_eq!(disposition, Disposition::Download);Variants§
Inline
Shows the file in the page or tab when its type is safe to display, and downloads anything else.
Safe types: raster images (PNG, JPEG, GIF, WebP, AVIF, BMP, TIFF,
icons), PDF, plain text, audio and video (MPEG, Ogg, WAV, WebM, MP4).
HTML, SVG, XML and JavaScript are sent as application/octet-stream
downloads, so an uploaded file never runs as part of the app (Rails’
content_types_allowed_inline / content_types_to_serve_as_binary).
Download
Always downloads the file, with its original name.
Trait Implementations§
Source§impl Clone for Disposition
impl Clone for Disposition
Source§fn clone(&self) -> Disposition
fn clone(&self) -> Disposition
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for Disposition
Source§impl Debug for Disposition
impl Debug for Disposition
impl Eq for Disposition
Source§impl PartialEq for Disposition
impl PartialEq for Disposition
Source§fn eq(&self, other: &Disposition) -> bool
fn eq(&self, other: &Disposition) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for Disposition
Auto Trait Implementations§
impl Freeze for Disposition
impl RefUnwindSafe for Disposition
impl Send for Disposition
impl Sync for Disposition
impl Unpin for Disposition
impl UnsafeUnpin for Disposition
impl UnwindSafe for Disposition
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.