pub struct AssetDb {
pub schema_version: u16,
pub script_types: Vec<u128>,
pub entries: Vec<AssetEntry>,
}Expand description
Whole-database envelope. entries is sorted by guid so convert-time
lookups are binary_search_by_key.
Fields§
§schema_version: u16§script_types: Vec<u128>Interned script GUIDs (u128). AssetType::Script(idx) indexes here.
Sorted ascending; deduplicated.
entries: Vec<AssetEntry>Sorted by guid ascending.
Implementations§
Source§impl AssetDb
impl AssetDb
pub fn new() -> Self
Sourcepub fn find_by_guid(&self, guid: u128) -> Option<&AssetEntry>
pub fn find_by_guid(&self, guid: u128) -> Option<&AssetEntry>
O(log n) lookup by GUID. None if absent.
Sourcepub fn script_guid(&self, idx: u32) -> u128
pub fn script_guid(&self, idx: u32) -> u128
Resolve AssetType::Script(idx) to its underlying script GUID.
Panics on out-of-range idx — that’s a corrupt-file error, fail loud.
Sourcepub fn intern_script(&mut self, guid: u128) -> u32
pub fn intern_script(&mut self, guid: u128) -> u32
Bake-side intern: returns the index of guid, inserting if new.
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for AssetDb
impl<'__de, __Context> BorrowDecode<'__de, __Context> for AssetDb
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
Auto Trait Implementations§
impl Freeze for AssetDb
impl RefUnwindSafe for AssetDb
impl Send for AssetDb
impl Sync for AssetDb
impl Unpin for AssetDb
impl UnsafeUnpin for AssetDb
impl UnwindSafe for AssetDb
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
Mutably borrows from an owned value. Read more