pub struct BinaryAssets { /* private fields */ }Expand description
One world’s binary payload store. Explicit collection keeps only caller-supplied reachable handles; graph ownership, not a run’s lifetime, determines reachability. Host pins must be included along with graph references when collecting.
Implementations§
Source§impl BinaryAssets
impl BinaryAssets
Sourcepub fn with_limits(limits: BinaryLimits) -> Self
pub fn with_limits(limits: BinaryLimits) -> Self
Empty store with host-selected allocation limits.
Sourcepub fn get(&self, id: BinaryId) -> Result<&[u8], BinaryError>
pub fn get(&self, id: BinaryId) -> Result<&[u8], BinaryError>
Borrow an asset’s bytes, or return BinaryError::Missing.
Sourcepub fn insert(&mut self, bytes: Vec<u8>) -> Result<BinaryId, BinaryError>
pub fn insert(&mut self, bytes: Vec<u8>) -> Result<BinaryId, BinaryError>
Retain bytes once, deduplicated by SHA-256. Return a limit error when allocation bounds are exceeded or a corruption error on a hash collision.
Sourcepub fn intern(
&mut self,
source: DocumentSourceKind,
) -> Result<PartSource, BinaryError>
pub fn intern( &mut self, source: DocumentSourceKind, ) -> Result<PartSource, BinaryError>
Convert a transport source to graph data. Repeated encoded strings are decoded once while their cached spelling and asset remain retained. Returns errors for invalid base64, allocation limits, or inconsistent assets.
Sourcepub fn resolve(
&self,
source: &PartSource,
) -> Result<DocumentSourceKind, BinaryError>
pub fn resolve( &self, source: &PartSource, ) -> Result<DocumentSourceKind, BinaryError>
Rebuild the transport source with its saved spelling, returning an error for missing bytes, invalid spelling metadata, or size overflow.
Sourcepub fn retain(
&mut self,
roots: impl IntoIterator<Item = BinaryId>,
) -> Result<(), BinaryError>
pub fn retain( &mut self, roots: impl IntoIterator<Item = BinaryId>, ) -> Result<(), BinaryError>
Drop assets unreachable from all graph references and explicit host pins. Missing roots are an error and leave the store unchanged.
Sourcepub fn iter(&self) -> impl Iterator<Item = (BinaryId, &[u8])>
pub fn iter(&self) -> impl Iterator<Item = (BinaryId, &[u8])>
Assets in deterministic content-hash order for scene construction.
Sourcepub fn from_payloads(
payloads: impl IntoIterator<Item = (BinaryId, Vec<u8>)>,
limits: BinaryLimits,
) -> Result<Self, BinaryError>
pub fn from_payloads( payloads: impl IntoIterator<Item = (BinaryId, Vec<u8>)>, limits: BinaryLimits, ) -> Result<Self, BinaryError>
Validate all saved identities and limits in an isolated store. The caller installs it only after graph handles and the rest of the scene validate. Returns an error for incorrect hashes, duplicate IDs, or exceeded limits.
Source§impl BinaryAssets
impl BinaryAssets
Sourcepub fn snapshot(&self) -> Vec<BinaryRecord>
pub fn snapshot(&self) -> Vec<BinaryRecord>
Snapshot the retained store in content-hash order.
Sourcepub fn merged(&self, records: &[BinaryRecord]) -> Result<Self, BinaryError>
pub fn merged(&self, records: &[BinaryRecord]) -> Result<Self, BinaryError>
Build an isolated merged store using the destination’s limits. Invalid hashes, duplicate saved IDs, invalid base64, or allocation excess return an error without mutating the destination.
Trait Implementations§
Source§impl Component for BinaryAssets
impl Component for BinaryAssets
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
ComponentRelationshipAccessor required for working with relationships in dynamic contexts. Read moreSource§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§impl Debug for BinaryAssets
impl Debug for BinaryAssets
Source§impl Default for BinaryAssets
impl Default for BinaryAssets
impl Resource for BinaryAssets
Auto Trait Implementations§
impl Freeze for BinaryAssets
impl RefUnwindSafe for BinaryAssets
impl Send for BinaryAssets
impl Sync for BinaryAssets
impl Unpin for BinaryAssets
impl UnsafeUnpin for BinaryAssets
impl UnwindSafe for BinaryAssets
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
Source§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
Source§fn get_component_ids(
components: &Components,
) -> impl Iterator<Item = Option<ComponentId>>
fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
Source§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
Source§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().