Struct resources_package_package::Package
source · pub struct Package {
pub data: &'static [(&'static [u8], &'static [u8])],
}
Expand description
Represents a package of resources created by resources_package!
.
Fields§
§data: &'static [(&'static [u8], &'static [u8])]
This member is public for technical reasons. Don’t use it directly.
Implementations§
source§impl Package
impl Package
sourcepub fn find<P>(&self, resource: P) -> Option<&'static [u8]>where
P: AsRef<Path>,
pub fn find<P>(&self, resource: P) -> Option<&'static [u8]>where P: AsRef<Path>,
Attempts to find a resource in the package.
The parameter is a path relative to the directory specified in the macro. For example if
if you call resources_package!("../resources")
, calling find
with images/file.png
will attempt to find the file that was at ../resources/images/file.png
at compile-time.
Returns the content of the file, or None
if it was not found.
If multiple resources have the same path, the first one will be returned. You should try to avoid this situation.
Auto Trait Implementations§
impl RefUnwindSafe for Package
impl Send for Package
impl Sync for Package
impl Unpin for Package
impl UnwindSafe for Package
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