pub struct PresetLibrary { /* private fields */ }Expand description
A searchable library of named body presets.
Implementations§
Source§impl PresetLibrary
impl PresetLibrary
Sourcepub fn add(&mut self, preset: BodyPreset)
pub fn add(&mut self, preset: BodyPreset)
Add a preset to the library.
Sourcepub fn get(&self, name: &str) -> Option<&BodyPreset>
pub fn get(&self, name: &str) -> Option<&BodyPreset>
Look up a preset by name (case-sensitive).
Sourcepub fn preset_count(&self) -> usize
pub fn preset_count(&self) -> usize
Number of presets in the library.
Sourcepub fn by_category(&self, cat: &BodyCategory) -> Vec<&BodyPreset>
pub fn by_category(&self, cat: &BodyCategory) -> Vec<&BodyPreset>
All presets belonging to a given category.
Sourcepub fn with_tag(&self, tag: &str) -> Vec<&BodyPreset>
pub fn with_tag(&self, tag: &str) -> Vec<&BodyPreset>
All presets that have the given tag.
Sourcepub fn blend(&self, name_a: &str, name_b: &str, t: f32) -> Option<BodyParams>
pub fn blend(&self, name_a: &str, name_b: &str, t: f32) -> Option<BodyParams>
Blend two presets at weight t (0 = fully a, 1 = fully b).
Missing params default to 0.5. Returns None if either name is unknown.
Sourcepub fn nearest(&self, params: &BodyParams) -> Option<&BodyPreset>
pub fn nearest(&self, params: &BodyParams) -> Option<&BodyPreset>
Find the nearest preset to the given params by L2 distance in param space.
Missing params in either side default to 0.5.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PresetLibrary
impl RefUnwindSafe for PresetLibrary
impl Send for PresetLibrary
impl Sync for PresetLibrary
impl Unpin for PresetLibrary
impl UnsafeUnpin for PresetLibrary
impl UnwindSafe for PresetLibrary
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more