Enum rocket_file_cache::CachedFile
[−]
[src]
pub enum CachedFile<'a> {
InMemory(NamedInMemoryFile<'a>),
FileSystem(NamedFile),
NotFound,
}Wrapper around types that represent files and implement Responder<'static>.
When getting a CachedFile from the cache:
An InMemory variant indicates that the file is now in the cache after the get.
A FileSystem variant indicates that the file is not in the cache, but it can be found in 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.
NotFoundThe file does not exist in either the cache or the filesystem.
Methods
impl<'a> CachedFile<'a>[src]
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> Debug for CachedFile<'a>[src]
impl<'a> From<NamedInMemoryFile<'a>> for CachedFile<'a>[src]
fn from(cached_file: NamedInMemoryFile<'a>) -> CachedFile<'a>[src]
Performs the conversion.
impl From<NamedFile> for CachedFile<'static>[src]
impl<'a> Responder<'a> for CachedFile<'a>[src]
fn respond_to(self, request: &Request) -> Result<Response<'a>, Status>[src]
Returns Ok if a Response could be generated successfully. Otherwise, returns an Err with a failing Status. Read more