pub struct ModelPicker { /* private fields */ }Expand description
A choice of local AI models, however many there are, to download, try, use and remove. It shows what it is
given: deciding which models fit and doing the work is up to the app, or to
ravenrs-ai.
use ravenrs_widgets::{ModelChoice, ModelPicker, ModelStatus};
let picker = ModelPicker::new(vec![ModelChoice {
name: "Small model".into(),
details: "1.1 GB · Apache 2.0".into(),
status: ModelStatus::Available,
in_use: false,
result: None,
error: None,
}])
.on_download(|index| println!("download {index}"));Implementations§
Source§impl ModelPicker
impl ModelPicker
Sourcepub fn new(choices: Vec<ModelChoice>) -> ModelPicker
pub fn new(choices: Vec<ModelChoice>) -> ModelPicker
A list of these models.
Sourcepub fn labels(self, labels: ModelPickerLabels) -> ModelPicker
pub fn labels(self, labels: ModelPickerLabels) -> ModelPicker
The words it shows.
Sourcepub fn on_download(self, handler: impl Fn(usize) + 'static) -> ModelPicker
pub fn on_download(self, handler: impl Fn(usize) + 'static) -> ModelPicker
Called with a model’s position when someone asks to download it.
Sourcepub fn on_cancel(self, handler: impl Fn(usize) + 'static) -> ModelPicker
pub fn on_cancel(self, handler: impl Fn(usize) + 'static) -> ModelPicker
Called with a model’s position when someone stops its download.
Sourcepub fn on_test(self, handler: impl Fn(usize) + 'static) -> ModelPicker
pub fn on_test(self, handler: impl Fn(usize) + 'static) -> ModelPicker
Called with a model’s position when someone asks to try it.
Sourcepub fn on_use(self, handler: impl Fn(usize) + 'static) -> ModelPicker
pub fn on_use(self, handler: impl Fn(usize) + 'static) -> ModelPicker
Called with a model’s position when someone starts or stops using it.
Sourcepub fn on_remove(self, handler: impl Fn(usize) + 'static) -> ModelPicker
pub fn on_remove(self, handler: impl Fn(usize) + 'static) -> ModelPicker
Called with a model’s position when someone removes it.
Trait Implementations§
Source§impl Debug for ModelPicker
impl Debug for ModelPicker
Auto Trait Implementations§
impl !RefUnwindSafe for ModelPicker
impl !Send for ModelPicker
impl !Sync for ModelPicker
impl !UnwindSafe for ModelPicker
impl Freeze for ModelPicker
impl Unpin for ModelPicker
impl UnsafeUnpin for ModelPicker
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.