Run cargo fmt

This commit is contained in:
Héctor Ramón Jiménez 2025-02-21 01:22:56 +01:00
parent 28caeccf22
commit 9ceb467e6e
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
59 changed files with 100 additions and 98 deletions

View file

@ -1,5 +1,5 @@
#![allow(missing_docs)] #![allow(missing_docs)]
use criterion::{criterion_group, criterion_main, Bencher, Criterion}; use criterion::{Bencher, Criterion, criterion_group, criterion_main};
use iced::alignment; use iced::alignment;
use iced::mouse; use iced::mouse;

View file

@ -1,5 +1,5 @@
use crate::gradient::{self, Gradient};
use crate::Color; use crate::Color;
use crate::gradient::{self, Gradient};
/// The background of some element. /// The background of some element.
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]

View file

@ -227,12 +227,8 @@ macro_rules! color {
($r:expr, $g:expr, $b:expr) => { ($r:expr, $g:expr, $b:expr) => {
$crate::Color::from_rgb8($r, $g, $b) $crate::Color::from_rgb8($r, $g, $b)
}; };
($r:expr, $g:expr, $b:expr, $a:expr) => {{ ($r:expr, $g:expr, $b:expr, $a:expr) => {{ $crate::Color::from_rgba8($r, $g, $b, $a) }};
$crate::Color::from_rgba8($r, $g, $b, $a) ($hex:expr) => {{ $crate::color!($hex, 1.0) }};
}};
($hex:expr) => {{
$crate::color!($hex, 1.0)
}};
($hex:expr, $a:expr) => {{ ($hex:expr, $a:expr) => {{
let hex = $hex as u32; let hex = $hex as u32;

View file

@ -1,6 +1,6 @@
use crate::SmolStr;
use crate::keyboard::key; use crate::keyboard::key;
use crate::keyboard::{Key, Location, Modifiers}; use crate::keyboard::{Key, Location, Modifiers};
use crate::SmolStr;
/// A keyboard event. /// A keyboard event.
/// ///

View file

@ -1,6 +1,6 @@
use crate::InputMethod;
use crate::event; use crate::event;
use crate::window; use crate::window;
use crate::InputMethod;
/// A connection to the state of a shell. /// A connection to the state of a shell.
/// ///

View file

@ -1,5 +1,5 @@
//! Define the colors of a theme. //! Define the colors of a theme.
use crate::{color, Color}; use crate::{Color, color};
use palette::color_difference::Wcag21RelativeContrast; use palette::color_difference::Wcag21RelativeContrast;
use palette::rgb::Rgb; use palette::rgb::Rgb;

View file

@ -1,7 +1,7 @@
//! Operate on widgets that can be focused. //! Operate on widgets that can be focused.
use crate::widget::operation::{self, Operation, Outcome};
use crate::widget::Id;
use crate::Rectangle; use crate::Rectangle;
use crate::widget::Id;
use crate::widget::operation::{self, Operation, Outcome};
/// The internal state of a widget that can be focused. /// The internal state of a widget that can be focused.
pub trait Focusable { pub trait Focusable {

View file

@ -1,7 +1,7 @@
//! Operate on widgets that have text input. //! Operate on widgets that have text input.
use crate::widget::operation::Operation;
use crate::widget::Id;
use crate::Rectangle; use crate::Rectangle;
use crate::widget::Id;
use crate::widget::operation::Operation;
/// The internal state of a widget that has text input. /// The internal state of a widget that has text input.
pub trait TextInput { pub trait TextInput {

View file

@ -24,8 +24,8 @@ mod platform;
#[path = "settings/other.rs"] #[path = "settings/other.rs"]
mod platform; mod platform;
use crate::window::{Icon, Level, Position};
use crate::Size; use crate::Size;
use crate::window::{Icon, Level, Position};
pub use platform::PlatformSpecific; pub use platform::PlatformSpecific;

View file

@ -22,9 +22,9 @@ impl crate::Executor for Executor {
pub mod time { pub mod time {
//! Listen and react to time. //! Listen and react to time.
use crate::MaybeSend;
use crate::core::time::{Duration, Instant}; use crate::core::time::{Duration, Instant};
use crate::subscription::Subscription; use crate::subscription::Subscription;
use crate::MaybeSend;
use futures::stream; use futures::stream;
use std::future::Future; use std::future::Future;

View file

@ -1,8 +1,8 @@
//! Listen to runtime events. //! Listen to runtime events.
use crate::MaybeSend;
use crate::core::event::{self, Event}; use crate::core::event::{self, Event};
use crate::core::window; use crate::core::window;
use crate::subscription::{self, Subscription}; use crate::subscription::{self, Subscription};
use crate::MaybeSend;
/// Returns a [`Subscription`] to all the ignored runtime events. /// Returns a [`Subscription`] to all the ignored runtime events.
/// ///

View file

@ -1,9 +1,9 @@
//! Listen to keyboard events. //! Listen to keyboard events.
use crate::MaybeSend;
use crate::core; use crate::core;
use crate::core::event; use crate::core::event;
use crate::core::keyboard::{Event, Key, Modifiers}; use crate::core::keyboard::{Event, Key, Modifiers};
use crate::subscription::{self, Subscription}; use crate::subscription::{self, Subscription};
use crate::MaybeSend;
/// Listens to keyboard key presses and calls the given function /// Listens to keyboard key presses and calls the given function
/// to map them into actual messages. /// to map them into actual messages.

View file

@ -2,7 +2,7 @@
use crate::subscription; use crate::subscription;
use crate::{BoxFuture, BoxStream, Executor, MaybeSend}; use crate::{BoxFuture, BoxStream, Executor, MaybeSend};
use futures::{channel::mpsc, Sink}; use futures::{Sink, channel::mpsc};
use std::marker::PhantomData; use std::marker::PhantomData;
/// A batteries-included runtime of commands and subscriptions. /// A batteries-included runtime of commands and subscriptions.

View file

@ -120,9 +120,7 @@ pub trait Default {
#[derive(Clone, PartialEq, Eq, Debug, Error)] #[derive(Clone, PartialEq, Eq, Debug, Error)]
pub enum SurfaceError { pub enum SurfaceError {
/// A timeout was encountered while trying to acquire the next frame. /// A timeout was encountered while trying to acquire the next frame.
#[error( #[error("A timeout was encountered while trying to acquire the next frame")]
"A timeout was encountered while trying to acquire the next frame"
)]
Timeout, Timeout,
/// The underlying surface has changed, and therefore the surface must be updated. /// The underlying surface has changed, and therefore the surface must be updated.
#[error( #[error(

View file

@ -1,4 +1,4 @@
use crate::geometry::path::{arc, Arc, Path}; use crate::geometry::path::{Arc, Path, arc};
use crate::core::border; use crate::core::border;
use crate::core::{Point, Radians, Size}; use crate::core::{Point, Radians, Size};
@ -171,8 +171,12 @@ impl Builder {
radius: border::Radius, radius: border::Radius,
) { ) {
let min_size = (size.height / 2.0).min(size.width / 2.0); let min_size = (size.height / 2.0).min(size.width / 2.0);
let [top_left_corner, top_right_corner, bottom_right_corner, bottom_left_corner] = let [
radius.into(); top_left_corner,
top_right_corner,
bottom_right_corner,
bottom_left_corner,
] = radius.into();
self.move_to(Point::new( self.move_to(Point::new(
top_left.x + min_size.min(top_left_corner), top_left.x + min_size.min(top_left_corner),

View file

@ -2,9 +2,9 @@
#[cfg(feature = "image")] #[cfg(feature = "image")]
pub use ::image as image_rs; pub use ::image as image_rs;
use crate::core::Rectangle;
use crate::core::image; use crate::core::image;
use crate::core::svg; use crate::core::svg;
use crate::core::Rectangle;
/// A raster or vector image. /// A raster or vector image.
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]

View file

@ -1,5 +1,5 @@
use crate::core::{Font, Pixels};
use crate::Antialiasing; use crate::Antialiasing;
use crate::core::{Font, Pixels};
/// The settings of a renderer. /// The settings of a renderer.
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]

View file

@ -1,9 +1,9 @@
//! A syntax highlighter for iced. //! A syntax highlighter for iced.
use iced_core as core; use iced_core as core;
use crate::core::Color;
use crate::core::font::{self, Font}; use crate::core::font::{self, Font};
use crate::core::text::highlighter::{self, Format}; use crate::core::text::highlighter::{self, Format};
use crate::core::Color;
use std::ops::Range; use std::ops::Range;
use std::sync::LazyLock; use std::sync::LazyLock;

View file

@ -74,10 +74,10 @@ impl<A, B> core::text::Renderer for Renderer<A, B>
where where
A: core::text::Renderer, A: core::text::Renderer,
B: core::text::Renderer< B: core::text::Renderer<
Font = A::Font, Font = A::Font,
Paragraph = A::Paragraph, Paragraph = A::Paragraph,
Editor = A::Editor, Editor = A::Editor,
>, >,
{ {
type Font = A::Font; type Font = A::Font;
type Paragraph = A::Paragraph; type Paragraph = A::Paragraph;

View file

@ -1,6 +1,6 @@
//! Load and use fonts. //! Load and use fonts.
use crate::task::{self, Task};
use crate::Action; use crate::Action;
use crate::task::{self, Task};
use std::borrow::Cow; use std::borrow::Cow;
/// An error while loading a font. /// An error while loading a font.

View file

@ -1,8 +1,8 @@
//! Build interactive programs using The Elm Architecture. //! Build interactive programs using The Elm Architecture.
use crate::Task;
use crate::core::text; use crate::core::text;
use crate::core::window; use crate::core::window;
use crate::core::{Element, Renderer}; use crate::core::{Element, Renderer};
use crate::Task;
/// The core of a user interface for a multi-window application following The Elm Architecture. /// The core of a user interface for a multi-window application following The Elm Architecture.
pub trait Program: Sized { pub trait Program: Sized {

View file

@ -1,8 +1,8 @@
//! Build interactive programs using The Elm Architecture. //! Build interactive programs using The Elm Architecture.
use crate::Task; use crate::Task;
use iced_core::text;
use iced_core::Element; use iced_core::Element;
use iced_core::text;
mod state; mod state;

View file

@ -1,17 +1,17 @@
//! Create runtime tasks. //! Create runtime tasks.
use crate::Action;
use crate::core::widget; use crate::core::widget;
use crate::futures::futures::channel::mpsc; use crate::futures::futures::channel::mpsc;
use crate::futures::futures::channel::oneshot; use crate::futures::futures::channel::oneshot;
use crate::futures::futures::future::{self, FutureExt}; use crate::futures::futures::future::{self, FutureExt};
use crate::futures::futures::stream::{self, Stream, StreamExt}; use crate::futures::futures::stream::{self, Stream, StreamExt};
use crate::futures::{boxed_stream, BoxStream, MaybeSend}; use crate::futures::{BoxStream, MaybeSend, boxed_stream};
use crate::Action;
use std::future::Future; use std::future::Future;
use std::sync::Arc; use std::sync::Arc;
#[doc(no_inline)] #[doc(no_inline)]
pub use sipper::{sipper, stream, Never, Sender, Sipper, Straw}; pub use sipper::{Never, Sender, Sipper, Straw, sipper, stream};
/// A set of concurrent actions to be performed by the iced runtime. /// A set of concurrent actions to be performed by the iced runtime.
/// ///

View file

@ -5,9 +5,9 @@ use crate::core::window::{
UserAttention, UserAttention,
}; };
use crate::core::{Point, Size}; use crate::core::{Point, Size};
use crate::futures::Subscription;
use crate::futures::event; use crate::futures::event;
use crate::futures::futures::channel::oneshot; use crate::futures::futures::channel::oneshot;
use crate::futures::Subscription;
use crate::task::{self, Task}; use crate::task::{self, Task};
pub use raw_window_handle; pub use raw_window_handle;

View file

@ -2,8 +2,8 @@
pub mod subscription { pub mod subscription {
//! Write your own subscriptions. //! Write your own subscriptions.
pub use crate::runtime::futures::subscription::{ pub use crate::runtime::futures::subscription::{
from_recipe, into_recipes, Event, EventStream, Hasher, MacOS, Event, EventStream, Hasher, MacOS, PlatformSpecific, Recipe,
PlatformSpecific, Recipe, from_recipe, into_recipes,
}; };
} }
@ -13,6 +13,7 @@ pub mod widget {
pub use crate::runtime::task::widget as operate; pub use crate::runtime::task::widget as operate;
} }
pub use crate::core::Shell;
pub use crate::core::clipboard::{self, Clipboard}; pub use crate::core::clipboard::{self, Clipboard};
pub use crate::core::image; pub use crate::core::image;
pub use crate::core::layout::{self, Layout}; pub use crate::core::layout::{self, Layout};
@ -21,6 +22,5 @@ pub use crate::core::overlay::{self, Overlay};
pub use crate::core::renderer::{self, Renderer}; pub use crate::core::renderer::{self, Renderer};
pub use crate::core::svg; pub use crate::core::svg;
pub use crate::core::text::{self, Text}; pub use crate::core::text::{self, Text};
pub use crate::core::Shell;
pub use crate::renderer::graphics; pub use crate::renderer::graphics;
pub use widget::Widget; pub use widget::Widget;

View file

@ -505,22 +505,22 @@ pub use crate::core::gradient;
pub use crate::core::padding; pub use crate::core::padding;
pub use crate::core::theme; pub use crate::core::theme;
pub use crate::core::{ pub use crate::core::{
never, Alignment, Animation, Background, Border, Color, ContentFit, Alignment, Animation, Background, Border, Color, ContentFit, Degrees,
Degrees, Function, Gradient, Length, Padding, Pixels, Point, Radians, Function, Gradient, Length, Padding, Pixels, Point, Radians, Rectangle,
Rectangle, Rotation, Settings, Shadow, Size, Theme, Transformation, Vector, Rotation, Settings, Shadow, Size, Theme, Transformation, Vector, never,
}; };
pub use crate::runtime::exit; pub use crate::runtime::exit;
pub use iced_futures::Subscription; pub use iced_futures::Subscription;
pub use alignment::Horizontal::{Left, Right};
pub use alignment::Vertical::{Bottom, Top};
pub use Alignment::Center; pub use Alignment::Center;
pub use Length::{Fill, FillPortion, Shrink}; pub use Length::{Fill, FillPortion, Shrink};
pub use alignment::Horizontal::{Left, Right};
pub use alignment::Vertical::{Bottom, Top};
pub mod task { pub mod task {
//! Create runtime tasks. //! Create runtime tasks.
pub use crate::runtime::task::{ pub use crate::runtime::task::{
sipper, stream, Handle, Never, Sipper, Straw, Task, Handle, Never, Sipper, Straw, Task, sipper, stream,
}; };
} }
@ -683,7 +683,7 @@ pub fn run<State, Message, Theme, Renderer>(
title: impl application::Title<State> + 'static, title: impl application::Title<State> + 'static,
update: impl application::Update<State, Message> + 'static, update: impl application::Update<State, Message> + 'static,
view: impl for<'a> application::View<'a, State, Message, Theme, Renderer> view: impl for<'a> application::View<'a, State, Message, Theme, Renderer>
+ 'static, + 'static,
) -> Result ) -> Result
where where
State: Default + 'static, State: Default + 'static,

View file

@ -1,10 +1,10 @@
use crate::Primitive;
use crate::core::renderer::Quad; use crate::core::renderer::Quad;
use crate::core::{ use crate::core::{
Background, Color, Gradient, Rectangle, Size, Transformation, Vector, Background, Color, Gradient, Rectangle, Size, Transformation, Vector,
}; };
use crate::graphics::{Image, Text}; use crate::graphics::{Image, Text};
use crate::text; use crate::text;
use crate::Primitive;
#[derive(Debug)] #[derive(Debug)]
pub struct Engine { pub struct Engine {

View file

@ -1,3 +1,4 @@
use crate::Primitive;
use crate::core::text::LineHeight; use crate::core::text::LineHeight;
use crate::core::{self, Pixels, Point, Radians, Rectangle, Size, Svg, Vector}; use crate::core::{self, Pixels, Point, Radians, Rectangle, Size, Svg, Vector};
use crate::graphics::cache::{self, Cached}; use crate::graphics::cache::{self, Cached};
@ -5,7 +6,6 @@ use crate::graphics::geometry::fill::{self, Fill};
use crate::graphics::geometry::stroke::{self, Stroke}; use crate::graphics::geometry::stroke::{self, Stroke};
use crate::graphics::geometry::{self, Path, Style}; use crate::graphics::geometry::{self, Path, Style};
use crate::graphics::{self, Gradient, Image, Text}; use crate::graphics::{self, Gradient, Image, Text};
use crate::Primitive;
use std::rc::Rc; use std::rc::Rc;

View file

@ -1,3 +1,4 @@
use crate::Primitive;
use crate::core::renderer::Quad; use crate::core::renderer::Quad;
use crate::core::{ use crate::core::{
self, Background, Color, Point, Rectangle, Svg, Transformation, self, Background, Color, Point, Rectangle, Svg, Transformation,
@ -6,7 +7,6 @@ use crate::graphics::damage;
use crate::graphics::layer; use crate::graphics::layer;
use crate::graphics::text::{Editor, Paragraph, Text}; use crate::graphics::text::{Editor, Paragraph, Text};
use crate::graphics::{self, Image}; use crate::graphics::{self, Image};
use crate::Primitive;
use std::rc::Rc; use std::rc::Rc;

View file

@ -32,9 +32,9 @@ use crate::core::{
Background, Color, Font, Pixels, Point, Rectangle, Size, Transformation, Background, Color, Font, Pixels, Point, Rectangle, Size, Transformation,
}; };
use crate::engine::Engine; use crate::engine::Engine;
use crate::graphics::Viewport;
use crate::graphics::compositor; use crate::graphics::compositor;
use crate::graphics::text::{Editor, Paragraph}; use crate::graphics::text::{Editor, Paragraph};
use crate::graphics::Viewport;
/// A [`tiny-skia`] graphics renderer for [`iced`]. /// A [`tiny-skia`] graphics renderer for [`iced`].
/// ///

View file

@ -713,7 +713,7 @@ fn into_fill_rule(rule: fill::Rule) -> lyon::tessellation::FillRule {
pub(super) fn dashed(path: &Path, line_dash: LineDash<'_>) -> Path { pub(super) fn dashed(path: &Path, line_dash: LineDash<'_>) -> Path {
use lyon::algorithms::walk::{ use lyon::algorithms::walk::{
walk_along_path, RepeatedPattern, WalkerEvent, RepeatedPattern, WalkerEvent, walk_along_path,
}; };
use lyon::path::iterator::PathIterator; use lyon::path::iterator::PathIterator;

View file

@ -9,8 +9,8 @@ mod raster;
#[cfg(feature = "svg")] #[cfg(feature = "svg")]
mod vector; mod vector;
use crate::core::{Rectangle, Size, Transformation};
use crate::Buffer; use crate::Buffer;
use crate::core::{Rectangle, Size, Transformation};
use bytemuck::{Pod, Zeroable}; use bytemuck::{Pod, Zeroable};

View file

@ -1,5 +1,5 @@
use crate::core::image;
use crate::core::Size; use crate::core::Size;
use crate::core::image;
use crate::graphics; use crate::graphics;
use crate::graphics::image::image_rs; use crate::graphics::image::image_rs;
use crate::image::atlas::{self, Atlas}; use crate::image::atlas::{self, Atlas};

View file

@ -1,11 +1,11 @@
use crate::core::{ use crate::core::{
self, renderer, Background, Color, Point, Rectangle, Svg, Transformation, self, Background, Color, Point, Rectangle, Svg, Transformation, renderer,
}; };
use crate::graphics; use crate::graphics;
use crate::graphics::Mesh;
use crate::graphics::color; use crate::graphics::color;
use crate::graphics::layer; use crate::graphics::layer;
use crate::graphics::text::{Editor, Paragraph}; use crate::graphics::text::{Editor, Paragraph};
use crate::graphics::Mesh;
use crate::image::{self, Image}; use crate::image::{self, Image};
use crate::primitive::{self, Primitive}; use crate::primitive::{self, Primitive};
use crate::quad::{self, Quad}; use crate::quad::{self, Quad};

View file

@ -64,8 +64,8 @@ use crate::core::{
Background, Color, Font, Pixels, Point, Rectangle, Size, Transformation, Background, Color, Font, Pixels, Point, Rectangle, Size, Transformation,
Vector, Vector,
}; };
use crate::graphics::text::{Editor, Paragraph};
use crate::graphics::Viewport; use crate::graphics::Viewport;
use crate::graphics::text::{Editor, Paragraph};
/// A [`wgpu`] graphics renderer for [`iced`]. /// A [`wgpu`] graphics renderer for [`iced`].
/// ///
@ -403,9 +403,9 @@ impl Renderer {
overlay: &[impl AsRef<str>], overlay: &[impl AsRef<str>],
viewport: &Viewport, viewport: &Viewport,
) { ) {
use crate::core::Renderer as _;
use crate::core::alignment; use crate::core::alignment;
use crate::core::text::Renderer as _; use crate::core::text::Renderer as _;
use crate::core::Renderer as _;
self.with_layer( self.with_layer(
Rectangle::with_size(viewport.logical_size()), Rectangle::with_size(viewport.logical_size()),

View file

@ -1,6 +1,6 @@
use crate::Buffer;
use crate::graphics::gradient; use crate::graphics::gradient;
use crate::quad::{self, Quad}; use crate::quad::{self, Quad};
use crate::Buffer;
use bytemuck::{Pod, Zeroable}; use bytemuck::{Pod, Zeroable};
use std::ops::Range; use std::ops::Range;

View file

@ -1,6 +1,6 @@
use crate::Buffer;
use crate::graphics::color; use crate::graphics::color;
use crate::quad::{self, Quad}; use crate::quad::{self, Quad};
use crate::Buffer;
use bytemuck::{Pod, Zeroable}; use bytemuck::{Pod, Zeroable};
use std::ops::Range; use std::ops::Range;

View file

@ -3,7 +3,7 @@ use crate::core::{Rectangle, Size, Transformation};
use crate::graphics::cache; use crate::graphics::cache;
use crate::graphics::color; use crate::graphics::color;
use crate::graphics::text::cache::{self as text_cache, Cache as BufferCache}; use crate::graphics::text::cache::{self as text_cache, Cache as BufferCache};
use crate::graphics::text::{font_system, to_color, Editor, Paragraph}; use crate::graphics::text::{Editor, Paragraph, font_system, to_color};
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use std::collections::hash_map; use std::collections::hash_map;

View file

@ -1,10 +1,10 @@
//! Draw meshes of triangles. //! Draw meshes of triangles.
mod msaa; mod msaa;
use crate::core::{Rectangle, Size, Transformation};
use crate::graphics::mesh::{self, Mesh};
use crate::graphics::Antialiasing;
use crate::Buffer; use crate::Buffer;
use crate::core::{Rectangle, Size, Transformation};
use crate::graphics::Antialiasing;
use crate::graphics::mesh::{self, Mesh};
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use std::collections::hash_map; use std::collections::hash_map;
@ -644,10 +644,10 @@ impl Uniforms {
} }
mod solid { mod solid {
use crate::graphics::mesh;
use crate::graphics::Antialiasing;
use crate::triangle;
use crate::Buffer; use crate::Buffer;
use crate::graphics::Antialiasing;
use crate::graphics::mesh;
use crate::triangle;
#[derive(Debug)] #[derive(Debug)]
pub struct Pipeline { pub struct Pipeline {
@ -795,11 +795,11 @@ mod solid {
} }
mod gradient { mod gradient {
use crate::Buffer;
use crate::graphics::Antialiasing;
use crate::graphics::color; use crate::graphics::color;
use crate::graphics::mesh; use crate::graphics::mesh;
use crate::graphics::Antialiasing;
use crate::triangle; use crate::triangle;
use crate::Buffer;
#[derive(Debug)] #[derive(Debug)]
pub struct Pipeline { pub struct Pipeline {

View file

@ -23,8 +23,8 @@ use crate::core::overlay;
use crate::core::renderer; use crate::core::renderer;
use crate::core::theme::palette; use crate::core::theme::palette;
use crate::core::touch; use crate::core::touch;
use crate::core::widget::tree::{self, Tree};
use crate::core::widget::Operation; use crate::core::widget::Operation;
use crate::core::widget::tree::{self, Tree};
use crate::core::window; use crate::core::window;
use crate::core::{ use crate::core::{
Background, Clipboard, Color, Element, Event, Layout, Length, Padding, Background, Clipboard, Color, Element, Event, Layout, Length, Padding,

View file

@ -52,13 +52,13 @@ mod program;
pub use program::Program; pub use program::Program;
pub use crate::Action;
pub use crate::core::event::Event; pub use crate::core::event::Event;
pub use crate::graphics::cache::Group; pub use crate::graphics::cache::Group;
pub use crate::graphics::geometry::{ pub use crate::graphics::geometry::{
fill, gradient, path, stroke, Fill, Gradient, Image, LineCap, LineDash, Fill, Gradient, Image, LineCap, LineDash, LineJoin, Path, Stroke, Style,
LineJoin, Path, Stroke, Style, Text, Text, fill, gradient, path, stroke,
}; };
pub use crate::Action;
use crate::core::event; use crate::core::event;
use crate::core::layout::{self, Layout}; use crate::core::layout::{self, Layout};

View file

@ -1,8 +1,8 @@
use crate::Action;
use crate::canvas::mouse; use crate::canvas::mouse;
use crate::canvas::{Event, Geometry}; use crate::canvas::{Event, Geometry};
use crate::core::Rectangle; use crate::core::Rectangle;
use crate::graphics::geometry; use crate::graphics::geometry;
use crate::Action;
/// The state and logic of a [`Canvas`]. /// The state and logic of a [`Canvas`].
/// ///

View file

@ -30,9 +30,9 @@ use crate::core::theme;
use crate::core::widget::tree::{self, Tree}; use crate::core::widget::tree::{self, Tree};
use crate::core::widget::{self, Operation}; use crate::core::widget::{self, Operation};
use crate::core::{ use crate::core::{
self, color, Background, Clipboard, Color, Element, Event, Layout, Length, self, Background, Clipboard, Color, Element, Event, Layout, Length,
Padding, Pixels, Point, Rectangle, Shadow, Shell, Size, Theme, Vector, Padding, Pixels, Point, Rectangle, Shadow, Shell, Size, Theme, Vector,
Widget, Widget, color,
}; };
use crate::runtime::task::{self, Task}; use crate::runtime::task::{self, Task};

View file

@ -14,8 +14,8 @@ use crate::pick_list::{self, PickList};
use crate::progress_bar::{self, ProgressBar}; use crate::progress_bar::{self, ProgressBar};
use crate::radio::{self, Radio}; use crate::radio::{self, Radio};
use crate::rule::{self, Rule}; use crate::rule::{self, Rule};
use crate::runtime::task::{self, Task};
use crate::runtime::Action; use crate::runtime::Action;
use crate::runtime::task::{self, Task};
use crate::scrollable::{self, Scrollable}; use crate::scrollable::{self, Scrollable};
use crate::slider::{self, Slider}; use crate::slider::{self, Slider};
use crate::text::{self, Text}; use crate::text::{self, Text};

View file

@ -3,8 +3,8 @@ use crate::core::layout;
use crate::core::mouse; use crate::core::mouse;
use crate::core::overlay; use crate::core::overlay;
use crate::core::renderer; use crate::core::renderer;
use crate::core::widget::tree::{self, Tree};
use crate::core::widget::Operation; use crate::core::widget::Operation;
use crate::core::widget::tree::{self, Tree};
use crate::core::{ use crate::core::{
Alignment, Clipboard, Element, Event, Layout, Length, Padding, Pixels, Alignment, Clipboard, Element, Event, Layout, Length, Padding, Pixels,
Rectangle, Shell, Size, Vector, Widget, Rectangle, Shell, Size, Vector, Widget,

View file

@ -10,13 +10,13 @@ pub use responsive::Responsive;
mod cache; mod cache;
use crate::core::Element;
use crate::core::layout::{self, Layout}; use crate::core::layout::{self, Layout};
use crate::core::mouse; use crate::core::mouse;
use crate::core::overlay; use crate::core::overlay;
use crate::core::renderer; use crate::core::renderer;
use crate::core::widget::tree::{self, Tree}; use crate::core::widget::tree::{self, Tree};
use crate::core::widget::{self, Widget}; use crate::core::widget::{self, Widget};
use crate::core::Element;
use crate::core::{ use crate::core::{
self, Clipboard, Event, Length, Point, Rectangle, Shell, Size, Vector, self, Clipboard, Event, Length, Point, Rectangle, Shell, Size, Vector,
}; };

View file

@ -1,6 +1,6 @@
#![allow(dead_code)] #![allow(dead_code)]
use crate::core::overlay;
use crate::core::Element; use crate::core::Element;
use crate::core::overlay;
use ouroboros::self_referencing; use ouroboros::self_referencing;

View file

@ -48,7 +48,7 @@ use crate::core::font::{self, Font};
use crate::core::padding; use crate::core::padding;
use crate::core::theme; use crate::core::theme;
use crate::core::{ use crate::core::{
self, color, Color, Element, Length, Padding, Pixels, Theme, self, Color, Element, Length, Padding, Pixels, Theme, color,
}; };
use crate::{column, container, rich_text, row, scrollable, span, text}; use crate::{column, container, rich_text, row, scrollable, span, text};

View file

@ -4,7 +4,7 @@ use crate::core::mouse;
use crate::core::overlay; use crate::core::overlay;
use crate::core::renderer; use crate::core::renderer;
use crate::core::touch; use crate::core::touch;
use crate::core::widget::{tree, Operation, Tree}; use crate::core::widget::{Operation, Tree, tree};
use crate::core::{ use crate::core::{
Clipboard, Element, Event, Layout, Length, Point, Rectangle, Shell, Size, Clipboard, Element, Event, Layout, Length, Point, Rectangle, Shell, Size,
Vector, Widget, Vector, Widget,

View file

@ -20,6 +20,7 @@
//! qr_code(&state.data).into() //! qr_code(&state.data).into()
//! } //! }
//! ``` //! ```
use crate::Renderer;
use crate::canvas; use crate::canvas;
use crate::core::layout; use crate::core::layout;
use crate::core::mouse; use crate::core::mouse;
@ -29,7 +30,6 @@ use crate::core::{
Color, Element, Layout, Length, Pixels, Point, Rectangle, Size, Theme, Color, Element, Layout, Length, Pixels, Point, Rectangle, Size, Theme,
Vector, Widget, Vector, Widget,
}; };
use crate::Renderer;
use std::cell::RefCell; use std::cell::RefCell;
use thiserror::Error; use thiserror::Error;

View file

@ -37,8 +37,8 @@ use crate::core::{
Length, Padding, Pixels, Point, Rectangle, Shell, Size, Theme, Vector, Length, Padding, Pixels, Point, Rectangle, Shell, Size, Theme, Vector,
Widget, Widget,
}; };
use crate::runtime::task::{self, Task};
use crate::runtime::Action; use crate::runtime::Action;
use crate::runtime::task::{self, Task};
pub use operation::scrollable::{AbsoluteOffset, RelativeOffset}; pub use operation::scrollable::{AbsoluteOffset, RelativeOffset};

View file

@ -14,8 +14,8 @@ use crate::renderer::wgpu::primitive;
use std::marker::PhantomData; use std::marker::PhantomData;
pub use crate::graphics::Viewport;
pub use crate::Action; pub use crate::Action;
pub use crate::graphics::Viewport;
pub use primitive::{Primitive, Storage}; pub use primitive::{Primitive, Storage};
/// A widget which can render custom shaders with Iced's `wgpu` backend. /// A widget which can render custom shaders with Iced's `wgpu` backend.

View file

@ -1,5 +1,5 @@
use crate::core::mouse;
use crate::core::Rectangle; use crate::core::Rectangle;
use crate::core::mouse;
use crate::renderer::wgpu::Primitive; use crate::renderer::wgpu::Primitive;
use crate::shader::{self, Action}; use crate::shader::{self, Action};

View file

@ -60,8 +60,8 @@ use crate::core::{
Background, Border, Color, Element, Event, InputMethod, Layout, Length, Background, Border, Color, Element, Event, InputMethod, Layout, Length,
Padding, Pixels, Point, Rectangle, Shell, Size, Theme, Vector, Widget, Padding, Pixels, Point, Rectangle, Shell, Size, Theme, Vector, Widget,
}; };
use crate::runtime::task::{self, Task};
use crate::runtime::Action; use crate::runtime::Action;
use crate::runtime::task::{self, Task};
/// A field that can be filled with text. /// A field that can be filled with text.
/// ///

View file

@ -3,8 +3,8 @@ use crate::core::layout;
use crate::core::mouse; use crate::core::mouse;
use crate::core::overlay; use crate::core::overlay;
use crate::core::renderer; use crate::core::renderer;
use crate::core::widget::tree::{self, Tree};
use crate::core::widget::Operation; use crate::core::widget::Operation;
use crate::core::widget::tree::{self, Tree};
use crate::core::{ use crate::core::{
Background, Clipboard, Color, Element, Event, Layout, Length, Point, Background, Clipboard, Color, Element, Event, Layout, Length, Point,
Rectangle, Shell, Size, Vector, Widget, Rectangle, Shell, Size, Vector, Widget,

View file

@ -470,8 +470,10 @@ where
layout::Node::with_children( layout::Node::with_children(
tooltip_bounds.size(), tooltip_bounds.size(),
vec![tooltip_layout vec![
.translate(Vector::new(self.padding, self.padding))], tooltip_layout
.translate(Vector::new(self.padding, self.padding)),
],
) )
.translate(Vector::new(tooltip_bounds.x, tooltip_bounds.y)) .translate(Vector::new(tooltip_bounds.x, tooltip_bounds.y))
} }

View file

@ -20,9 +20,9 @@ use crate::futures::futures::{Future, StreamExt};
use crate::futures::subscription::{self, Subscription}; use crate::futures::subscription::{self, Subscription};
use crate::futures::{Executor, Runtime}; use crate::futures::{Executor, Runtime};
use crate::graphics; use crate::graphics;
use crate::graphics::{compositor, Compositor}; use crate::graphics::{Compositor, compositor};
use crate::runtime::user_interface::{self, UserInterface};
use crate::runtime::Debug; use crate::runtime::Debug;
use crate::runtime::user_interface::{self, UserInterface};
use crate::runtime::{self, Action, Task}; use crate::runtime::{self, Action, Task};
use crate::{Clipboard, Error, Proxy, Settings}; use crate::{Clipboard, Error, Proxy, Settings};
@ -406,7 +406,9 @@ where
.with_canvas(self.canvas.take()) .with_canvas(self.canvas.take())
}; };
log::info!("Window attributes for id `{id:#?}`: {window_attributes:#?}"); log::info!(
"Window attributes for id `{id:#?}`: {window_attributes:#?}"
);
// On macOS, the `position` in `WindowAttributes` represents the "inner" // On macOS, the `position` in `WindowAttributes` represents the "inner"
// position of the window; while on other platforms it's the "outer" position. // position of the window; while on other platforms it's the "outer" position.

View file

@ -1,6 +1,6 @@
use crate::conversion; use crate::conversion;
use crate::core::{mouse, theme, window};
use crate::core::{Color, Size}; use crate::core::{Color, Size};
use crate::core::{mouse, theme, window};
use crate::graphics::Viewport; use crate::graphics::Viewport;
use crate::program::Program; use crate::program::Program;

View file

@ -1,8 +1,8 @@
use crate::futures::futures::{ use crate::futures::futures::{
Future, Sink, StreamExt,
channel::mpsc, channel::mpsc,
select, select,
task::{Context, Poll}, task::{Context, Poll},
Future, Sink, StreamExt,
}; };
use crate::runtime::Action; use crate::runtime::Action;
use std::pin::Pin; use std::pin::Pin;