Skip to main content

TargetIndex

Struct TargetIndex 

Source
pub struct TargetIndex { /* private fields */ }
Expand description

Searchable in-memory index of morph targets.

Implementations§

Source§

impl TargetIndex

Source

pub fn new() -> Self

Source

pub fn add(&mut self, entry: TargetEntry)

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn by_category(&self, cat: &TargetCategory) -> Vec<&TargetEntry>

Return all entries that belong to the given category.

Source

pub fn search(&self, query: &str) -> Vec<&TargetEntry>

Case-insensitive substring search on name or tags.

Source

pub fn by_name(&self, name: &str) -> Option<&TargetEntry>

Look up an entry by exact name (case-sensitive).

Source

pub fn all(&self) -> &[TargetEntry]

Source

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.

Source

pub fn from_dir(dir: &Path) -> Result<Self>

Build a TargetIndex by scanning a directory with a TargetScanner.

Source

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

Source§

fn default() -> TargetIndex

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.