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

source

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.

source

pub fn iter<'a>(&'a self) -> Iter<'a>

Returns an iterator to the entries in the package.

The return type implements Iterator<(Path, &'static [u8])>.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.