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>) -> Self
pub fn new(choices: Vec<ModelChoice>) -> Self
A list of these models.
Sourcepub fn labels(self, labels: ModelPickerLabels) -> Self
pub fn labels(self, labels: ModelPickerLabels) -> Self
The words it shows.
Sourcepub fn on_download(self, handler: impl Fn(usize) + 'static) -> Self
pub fn on_download(self, handler: impl Fn(usize) + 'static) -> Self
Called with a model’s position when someone asks to download it.
Sourcepub fn on_cancel(self, handler: impl Fn(usize) + 'static) -> Self
pub fn on_cancel(self, handler: impl Fn(usize) + 'static) -> Self
Called with a model’s position when someone stops its download.
Sourcepub fn on_test(self, handler: impl Fn(usize) + 'static) -> Self
pub fn on_test(self, handler: impl Fn(usize) + 'static) -> Self
Called with a model’s position when someone asks to try 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§
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<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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.