Skip to main content

register_owned

Function register_owned 

Source
pub fn register_owned(kind: AssetKind, bytes: Vec<u8>) -> u32
Expand description

Registers bytes this process built rather than bytes it was compiled with.

A gradient is worked out at run time, so there is no include_bytes! to point at. The bytes are handed to the registry to keep for the life of the process, which is what 'static means here and what a registration is anyway: an asset has to outlive every frame that draws it, and nothing ever un-registers by dropping.

The content comparison runs first, so building the same gradient on every render keeps one copy. Only a brush nobody has registered before is kept.