pub struct TargetIndex { /* private fields */ }Expand description
Searchable in-memory index of morph targets.
Implementations§
Source§impl TargetIndex
impl TargetIndex
pub fn new() -> Self
pub fn add(&mut self, entry: TargetEntry)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn by_category(&self, cat: &TargetCategory) -> Vec<&TargetEntry>
pub fn by_category(&self, cat: &TargetCategory) -> Vec<&TargetEntry>
Return all entries that belong to the given category.
Sourcepub fn search(&self, query: &str) -> Vec<&TargetEntry>
pub fn search(&self, query: &str) -> Vec<&TargetEntry>
Case-insensitive substring search on name or tags.
Sourcepub fn by_name(&self, name: &str) -> Option<&TargetEntry>
pub fn by_name(&self, name: &str) -> Option<&TargetEntry>
Look up an entry by exact name (case-sensitive).
pub fn all(&self) -> &[TargetEntry]
Sourcepub fn scan_dir(&mut self, dir: &Path) -> Result<usize>
pub fn scan_dir(&mut self, dir: &Path) -> Result<usize>
Walk dir, add one TargetEntry per .target file found.
The category is parsed from the name of the directory that directly contains the file. Returns the number of entries added.
Sourcepub fn from_dir(dir: &Path) -> Result<Self>
pub fn from_dir(dir: &Path) -> Result<Self>
Build a TargetIndex by scanning a directory with a TargetScanner.
Sourcepub fn to_manifest_targets(&self) -> Vec<String>
pub fn to_manifest_targets(&self) -> Vec<String>
Return just the entry names (for use in AssetManifest::allowed_targets).
Trait Implementations§
Source§impl Default for TargetIndex
impl Default for TargetIndex
Source§fn default() -> TargetIndex
fn default() -> TargetIndex
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TargetIndex
impl RefUnwindSafe for TargetIndex
impl Send for TargetIndex
impl Sync for TargetIndex
impl Unpin for TargetIndex
impl UnsafeUnpin for TargetIndex
impl UnwindSafe for TargetIndex
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