Trait cad_import::loader::Resource
source · pub trait Resource: Debug + ToString {
// Required methods
fn get_mime_type(&self) -> String;
fn sub(&self, s: &str, mime_type: &str) -> Result<Box<dyn Resource>, Error>;
fn open(&self) -> Result<Box<dyn Read>, Error>;
// Provided method
fn read_to_memory(&self) -> Result<Vec<u8>, Error> { ... }
}
Expand description
A resource is a descriptor to a specific resource, e.g., a filepath ot a URL. It is possible to create sub-resources from a resource, e.g., ‘../foobar.txt’.
Required Methods§
sourcefn get_mime_type(&self) -> String
fn get_mime_type(&self) -> String
Returns the mimetype of the current resource.