pub struct ProgressBar;Expand description
A simple progress bar that can be used to show the progress of something.
The input lens need to be a lens to an f32 with range of 0.0..1.0.
§Example
§Vertical ProgressBar bound to the input lens
ProgressBar::vertical(cx, AppData::progress);§Horizontal ProgressBar bound to the input lens
ProgressBar::horizontal(cx, AppData::progress);§A Horizontal ProgressBar with a label beside it to show the progress
HStack::new(cx, |cx| {
ProgressBar::horizontal(cx, AppData::progress);
Label::new(cx, AppData::progress.map(|v| format!("{:.0}%", v * 100.0)));
});Implementations§
Source§impl ProgressBar
impl ProgressBar
Sourcepub fn new<L>(
cx: &mut Context,
lens: L,
orientation: Orientation,
) -> Handle<'_, ProgressBar>
pub fn new<L>( cx: &mut Context, lens: L, orientation: Orientation, ) -> Handle<'_, ProgressBar>
Creates a new progress bar bound to the value targeted by the lens.
§Example
ProgressBar::new(cx, AppData::value, Orientation::Horizontal);Sourcepub fn horizontal<L>(cx: &mut Context, lens: L) -> Handle<'_, ProgressBar>
pub fn horizontal<L>(cx: &mut Context, lens: L) -> Handle<'_, ProgressBar>
Creates a new horizontal progress bar bound to the value targeted by the lens.
Trait Implementations§
Source§impl View for ProgressBar
impl View for ProgressBar
Source§fn element(&self) -> Option<&'static str>
fn element(&self) -> Option<&'static str>
Specifies a name for the view type which can be used as an element selector in css. Read more
Source§fn accessibility(&self, _cx: &mut AccessContext<'_>, node: &mut AccessNode)
fn accessibility(&self, _cx: &mut AccessContext<'_>, node: &mut AccessNode)
Provides a way to configure the accessibility features of a view.
Source§fn build<F>(self, cx: &mut Context, content: F) -> Handle<'_, Self>
fn build<F>(self, cx: &mut Context, content: F) -> Handle<'_, Self>
Builds the view into the tree and returns a handle which can be used to apply style and layout modifiers to the view. Read more
Auto Trait Implementations§
impl Freeze for ProgressBar
impl RefUnwindSafe for ProgressBar
impl Send for ProgressBar
impl Sync for ProgressBar
impl Unpin for ProgressBar
impl UnwindSafe for ProgressBar
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.