pub unsafe trait BorrowInfo {
    fn borrow_info(info: &mut Vec<TypeInfo>);
}
Expand description

Explains to a workload which storage are borrowed by a system.

Safety

Must accurately list everything borrowed.

Example of manual implementation:

use shipyard::{BorrowInfo, info::TypeInfo, View, UniqueView};

struct CameraView<'v> {
    camera: UniqueView<'v, Camera>,
    position: View<'v, Position>,
}

// SAFE: All storages info is recorded.
unsafe impl BorrowInfo for CameraView<'_> {
    fn borrow_info(info: &mut Vec<TypeInfo>) {
        <UniqueView<'_, Camera>>::borrow_info(info);
        <View<'_, Position>>::borrow_info(info);
    }
}

Required Methods

This information is used during workload creation to determine which systems can run in parallel.

A borrow error might happen if the information is not correct.

Implementations on Foreign Types

Implementors