Skip to main content

Assets

Struct Assets 

Source
pub struct Assets { /* private fields */ }
Expand description

Bounded project resource owner. Owners/handles retain project weak cache entries; dropping them releases cache payload charges. This is not a hard process-memory cap or an automatic file-change watcher.

Implementations§

Source§

impl Assets

Source

pub fn with_diagnostics(self, diagnostics: RequestDiagnostics) -> Self

Derives a request-local view without changing resource identity or ownership. Handles created from this view keep the explicit sink across threads.

Source

pub fn snapshot(&self) -> Self

Freezes existing entries while isolating future registrations from old clones. Snapshot versions still share project accounting and existing decoded payloads.

Source

pub fn preload<A: Asset>( &self, source: impl Into<Source>, value: Arc<A>, ) -> Result<Handle<A>>

Registers decoded data in the same bounded entry used by lazy handles. Performs no file read; an already resolved source is never replaced.

Source

pub fn with_store(self, store: ResourceStore) -> Self

Uses an explicit project store and drops this value’s retained entry table. Existing owner clones, handles and decoded values keep their original ownership.

Source

pub fn store(&self) -> &ResourceStore

Project cache identity and accounting shared by this owner’s clones.

Source

pub fn remove<A: Asset>(&self, source: impl Into<Source>) -> bool

Unregisters one typed source from this owner without invalidating handles. Clones share registrations; use snapshot() before independent edits. Retained snapshots and handles keep their payload charged until dropped.

Source

pub fn with_fonts(self, fonts: impl Into<FontEnvironment>) -> Self

Derives an independent resource view with an immutable font environment. Cache identity includes its snapshot; existing owners/handles stay valid.

Source

pub fn fonts(&self) -> Option<&FontEnvironment>

Font snapshot shared by layout and explicit SVG parsing.

Source

pub fn new(root: impl AsRef<Path>) -> Result<Self>

Captures a project asset directory without reading/decode/device work.

Source

pub fn load<A: Asset>(&self, source: impl Into<Source>) -> Handle<A>

Requests a lazy typed handle. Matching type/root/font snapshot/source shares one entry only among owners attached to the same ResourceStore. Creating a handle performs no file decode. Relative parent traversal is rejected.

Trait Implementations§

Source§

impl Clone for Assets

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Assets

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Assets

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for Assets

§

impl Freeze for Assets

§

impl Move for Assets

§

impl RefUnwindSafe for Assets

§

impl Send for Assets

§

impl Sync for Assets

§

impl Unpin for Assets

§

impl UnsafeUnpin for Assets

§

impl UnwindSafe for Assets

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.