[][src]Enum rocket_file_cache::CachedFile

pub enum CachedFile<'a> {
    InMemory(NamedInMemoryFile<'a>),
    FileSystem(NamedFile),
    NotFound,
}

Wrapper around data that can represent a file - either in memory (cache), or on disk.

When getting a CachedFile from the cache:

  • An InMemory variant indicates that the file was read into the cache and a reference to that file is attached to the variant.
  • A FileSystem variant indicates that the file is not in the cache, but it can be accessed from the filesystem.
  • A NotFound variant indicates that the file can not be found in the filesystem or the cache.

Variants

InMemory(NamedInMemoryFile<'a>)

A file that has been loaded into the cache.

FileSystem(NamedFile)

A file that exists in the filesystem.

NotFound

The file does not exist in either the cache or the filesystem.

Methods

impl<'a> CachedFile<'a>
[src]

pub fn open<P: AsRef<Path>>(path: P, cache: &'a Cache) -> CachedFile<'a>
[src]

A convenience function that wraps the getting of a cached file.

This is done to keep the code required to use the cache as similar to the typical use of rocket::response::NamedFile.

Trait Implementations

impl<'a> From<NamedInMemoryFile<'a>> for CachedFile<'a>
[src]

impl From<NamedFile> for CachedFile<'static>
[src]

impl<'a> PartialEq<CachedFile<'a>> for CachedFile<'a>
[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<'a> Debug for CachedFile<'a>
[src]

impl<'a> Responder<'a> for CachedFile<'a>
[src]

Auto Trait Implementations

impl<'a> Send for CachedFile<'a>

impl<'a> Sync for CachedFile<'a>

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> IntoCollection for T

impl<T, I> AsResult for T where
    I: Input,