pub struct ProgressBar<'a, Theme = Theme>where
Theme: Catalog,{ /* private fields */ }
Expand description
A bar that displays progress.
§Example
use iced::widget::progress_bar;
struct State {
progress: f32,
}
enum Message {
// ...
}
fn view(state: &State) -> Element<'_, Message> {
progress_bar(0.0..=100.0, state.progress).into()
}
Implementations§
Source§impl<'a, Theme> ProgressBar<'a, Theme>where
Theme: Catalog,
impl<'a, Theme> ProgressBar<'a, Theme>where
Theme: Catalog,
Sourcepub const DEFAULT_GIRTH: f32 = 30f32
pub const DEFAULT_GIRTH: f32 = 30f32
The default girth of a ProgressBar
.
Sourcepub fn new(range: RangeInclusive<f32>, value: f32) -> ProgressBar<'a, Theme>
pub fn new(range: RangeInclusive<f32>, value: f32) -> ProgressBar<'a, Theme>
Creates a new ProgressBar
.
It expects:
- an inclusive range of possible values
- the current value of the
ProgressBar
Sourcepub fn length(self, length: impl Into<Length>) -> ProgressBar<'a, Theme>
pub fn length(self, length: impl Into<Length>) -> ProgressBar<'a, Theme>
Sets the width of the ProgressBar
.
Sourcepub fn girth(self, girth: impl Into<Length>) -> ProgressBar<'a, Theme>
pub fn girth(self, girth: impl Into<Length>) -> ProgressBar<'a, Theme>
Sets the height of the ProgressBar
.
Sourcepub fn vertical(self) -> ProgressBar<'a, Theme>
pub fn vertical(self) -> ProgressBar<'a, Theme>
Turns the ProgressBar
into a vertical ProgressBar
.
By default, a ProgressBar
is horizontal.
Sourcepub fn style(
self,
style: impl Fn(&Theme) -> Style + 'a,
) -> ProgressBar<'a, Theme>
pub fn style( self, style: impl Fn(&Theme) -> Style + 'a, ) -> ProgressBar<'a, Theme>
Sets the style of the ProgressBar
.
Sourcepub fn class(
self,
class: impl Into<<Theme as Catalog>::Class<'a>>,
) -> ProgressBar<'a, Theme>
pub fn class( self, class: impl Into<<Theme as Catalog>::Class<'a>>, ) -> ProgressBar<'a, Theme>
Sets the style class of the ProgressBar
.
Trait Implementations§
Source§impl<'a, Message, Theme, Renderer> From<ProgressBar<'a, Theme>> for Element<'a, Message, Theme, Renderer>
impl<'a, Message, Theme, Renderer> From<ProgressBar<'a, Theme>> for Element<'a, Message, Theme, Renderer>
Source§fn from(
progress_bar: ProgressBar<'a, Theme>,
) -> Element<'a, Message, Theme, Renderer>
fn from( progress_bar: ProgressBar<'a, Theme>, ) -> Element<'a, Message, Theme, Renderer>
Converts to this type from the input type.
Source§impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer> for ProgressBar<'_, Theme>
impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer> for ProgressBar<'_, Theme>
Source§fn draw(
&self,
_state: &Tree,
renderer: &mut Renderer,
theme: &Theme,
_style: &Style,
layout: Layout<'_>,
_cursor: Cursor,
_viewport: &Rectangle,
)
fn draw( &self, _state: &Tree, renderer: &mut Renderer, theme: &Theme, _style: &Style, layout: Layout<'_>, _cursor: Cursor, _viewport: &Rectangle, )
Draws the
Widget
using the associated Renderer
.§fn operate(
&self,
_state: &mut Tree,
_layout: Layout<'_>,
_renderer: &Renderer,
_operation: &mut dyn Operation,
)
fn operate( &self, _state: &mut Tree, _layout: Layout<'_>, _renderer: &Renderer, _operation: &mut dyn Operation, )
§fn update(
&mut self,
_state: &mut Tree,
_event: &Event,
_layout: Layout<'_>,
_cursor: Cursor,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
_shell: &mut Shell<'_, Message>,
_viewport: &Rectangle,
)
fn update( &mut self, _state: &mut Tree, _event: &Event, _layout: Layout<'_>, _cursor: Cursor, _renderer: &Renderer, _clipboard: &mut dyn Clipboard, _shell: &mut Shell<'_, Message>, _viewport: &Rectangle, )
§fn mouse_interaction(
&self,
_state: &Tree,
_layout: Layout<'_>,
_cursor: Cursor,
_viewport: &Rectangle,
_renderer: &Renderer,
) -> Interaction
fn mouse_interaction( &self, _state: &Tree, _layout: Layout<'_>, _cursor: Cursor, _viewport: &Rectangle, _renderer: &Renderer, ) -> Interaction
Auto Trait Implementations§
impl<'a, Theme> Freeze for ProgressBar<'a, Theme>
impl<'a, Theme> RefUnwindSafe for ProgressBar<'a, Theme>
impl<'a, Theme> Send for ProgressBar<'a, Theme>
impl<'a, Theme> Sync for ProgressBar<'a, Theme>
impl<'a, Theme> Unpin for ProgressBar<'a, Theme>
impl<'a, Theme> UnwindSafe for ProgressBar<'a, Theme>
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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Turns some type into the initial state of some
Application
.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