Rename iced_native to iced_runtime

This commit is contained in:
Héctor Ramón Jiménez 2023-03-05 06:35:20 +01:00
parent 8af69be47e
commit 99e0a71504
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
39 changed files with 87 additions and 97 deletions

View file

@ -45,7 +45,7 @@ members = [
"core",
"futures",
"graphics",
"native",
"runtime",
"renderer",
"style",
"tiny_skia",

View file

@ -1,7 +1,7 @@
use iced_wgpu::Renderer;
use iced_widget::{slider, text_input, Column, Row, Text};
use iced_winit::core::{Alignment, Color, Element, Length};
use iced_winit::native::{Command, Program};
use iced_winit::runtime::{Command, Program};
use iced_winit::style::Theme;
pub struct Controls {

View file

@ -8,8 +8,8 @@ use iced_wgpu::graphics::Viewport;
use iced_wgpu::{wgpu, Backend, Renderer, Settings};
use iced_winit::core::renderer;
use iced_winit::core::{Color, Size};
use iced_winit::native::program;
use iced_winit::native::Debug;
use iced_winit::runtime::program;
use iced_winit::runtime::Debug;
use iced_winit::style::Theme;
use iced_winit::{conversion, futures, winit, Clipboard};

View file

@ -1,23 +0,0 @@
//! Build window-based GUI applications.
mod action;
pub use action::Action;
use crate::core::time::Instant;
use crate::core::window::Event;
use crate::futures::subscription::{self, Subscription};
/// Subscribes to the frames of the window of the running application.
///
/// The resulting [`Subscription`] will produce items at a rate equal to the
/// refresh rate of the window. Note that this rate may be variable, as it is
/// normally managed by the graphics driver and/or the OS.
///
/// In any case, this [`Subscription`] is useful to smoothly draw application-driven
/// animations without missing any frames.
pub fn frames() -> Subscription<Instant> {
subscription::raw_events(|event, _status| match event {
iced_core::Event::Window(Event::RedrawRequested(at)) => Some(at),
_ => None,
})
}

View file

@ -1,5 +1,5 @@
[package]
name = "iced_native"
name = "iced_runtime"
version = "0.9.1"
authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
edition = "2021"

View file

@ -1,5 +1,6 @@
//! Access the clipboard.
use iced_futures::MaybeSend;
use crate::command::{self, Command};
use crate::futures::MaybeSend;
use std::fmt;
@ -38,3 +39,15 @@ impl<T> fmt::Debug for Action<T> {
}
}
}
/// Read the current contents of the clipboard.
pub fn read<Message>(
f: impl Fn(Option<String>) -> Message + 'static,
) -> Command<Message> {
Command::single(command::Action::Clipboard(Action::Read(Box::new(f))))
}
/// Write the given contents to the clipboard.
pub fn write<Message>(contents: String) -> Command<Message> {
Command::single(command::Action::Clipboard(Action::Write(contents)))
}

View file

@ -32,7 +32,7 @@ pub struct UserInterface<'a, Message, Renderer> {
impl<'a, Message, Renderer> UserInterface<'a, Message, Renderer>
where
Renderer: iced_core::Renderer,
Renderer: crate::core::Renderer,
{
/// Builds a user interface for an [`Element`].
///
@ -46,7 +46,7 @@ where
///
/// ```no_run
/// # mod iced_wgpu {
/// # pub use iced_native::core::renderer::Null as Renderer;
/// # pub use iced_runtime::core::renderer::Null as Renderer;
/// # }
/// #
/// # pub struct Counter;
@ -56,8 +56,8 @@ where
/// # pub fn view(&self) -> iced_core::Element<(), Renderer> { unimplemented!() }
/// # pub fn update(&mut self, _: ()) {}
/// # }
/// use iced_native::core::Size;
/// use iced_native::user_interface::{self, UserInterface};
/// use iced_runtime::core::Size;
/// use iced_runtime::user_interface::{self, UserInterface};
/// use iced_wgpu::Renderer;
///
/// // Initialization
@ -119,7 +119,7 @@ where
///
/// ```no_run
/// # mod iced_wgpu {
/// # pub use iced_native::core::renderer::Null as Renderer;
/// # pub use iced_runtime::core::renderer::Null as Renderer;
/// # }
/// #
/// # pub struct Counter;
@ -129,8 +129,8 @@ where
/// # pub fn view(&self) -> iced_core::Element<(), Renderer> { unimplemented!() }
/// # pub fn update(&mut self, _: ()) {}
/// # }
/// use iced_native::core::{clipboard, Size, Point};
/// use iced_native::user_interface::{self, UserInterface};
/// use iced_runtime::core::{clipboard, Size, Point};
/// use iced_runtime::user_interface::{self, UserInterface};
/// use iced_wgpu::Renderer;
///
/// let mut counter = Counter::new();
@ -348,7 +348,7 @@ where
///
/// ```no_run
/// # mod iced_wgpu {
/// # pub use iced_native::core::renderer::Null as Renderer;
/// # pub use iced_runtime::core::renderer::Null as Renderer;
/// # pub type Theme = ();
/// # }
/// #
@ -359,10 +359,10 @@ where
/// # pub fn view(&self) -> Element<(), Renderer> { unimplemented!() }
/// # pub fn update(&mut self, _: ()) {}
/// # }
/// use iced_native::core::clipboard;
/// use iced_native::core::renderer;
/// use iced_native::core::{Element, Size, Point};
/// use iced_native::user_interface::{self, UserInterface};
/// use iced_runtime::core::clipboard;
/// use iced_runtime::core::renderer;
/// use iced_runtime::core::{Element, Size, Point};
/// use iced_runtime::user_interface::{self, UserInterface};
/// use iced_wgpu::{Renderer, Theme};
///
/// let mut counter = Counter::new();

View file

@ -1,7 +1,27 @@
//! Interact with the window of your application.
use crate::core::window::{Mode, UserAttention};
use crate::native::command::{self, Command};
use crate::native::window::Action;
//! Build window-based GUI applications.
mod action;
pub use action::Action;
use crate::command::{self, Command};
use crate::core::time::Instant;
use crate::core::window::{Event, Mode, UserAttention};
use crate::futures::subscription::{self, Subscription};
/// Subscribes to the frames of the window of the running application.
///
/// The resulting [`Subscription`] will produce items at a rate equal to the
/// refresh rate of the window. Note that this rate may be variable, as it is
/// normally managed by the graphics driver and/or the OS.
///
/// In any case, this [`Subscription`] is useful to smoothly draw application-driven
/// animations without missing any frames.
pub fn frames() -> Subscription<Instant> {
subscription::raw_events(|event, _status| match event {
iced_core::Event::Window(Event::RedrawRequested(at)) => Some(at),
_ => None,
})
}
/// Closes the current window and exits the application.
pub fn close<Message>() -> Command<Message> {

View file

@ -10,5 +10,5 @@ pub use crate::core::{Clipboard, Shell};
pub mod subscription {
//! Write your own subscriptions.
pub use crate::native::futures::subscription::{EventStream, Recipe};
pub use crate::runtime::futures::subscription::{EventStream, Recipe};
}

View file

@ -215,7 +215,7 @@ pub trait Application: Sized {
struct Instance<A: Application>(A);
impl<A> crate::native::Program for Instance<A>
impl<A> crate::runtime::Program for Instance<A>
where
A: Application,
{

View file

@ -169,7 +169,7 @@ use iced_widget::renderer;
use iced_widget::style;
use iced_winit as shell;
use iced_winit::core;
use iced_winit::native;
use iced_winit::runtime;
pub use iced_futures::futures;
@ -192,11 +192,11 @@ pub use crate::core::{
color, Alignment, Background, Color, ContentFit, Length, Padding, Point,
Rectangle, Size, Vector,
};
pub use crate::native::Command;
pub use crate::runtime::Command;
pub mod clipboard {
//! Access the clipboard.
pub use crate::shell::clipboard::{read, write};
pub use crate::runtime::clipboard::{read, write};
}
pub mod executor {
@ -219,7 +219,7 @@ pub mod executor {
pub mod font {
//! Load and use fonts.
pub use crate::core::font::*;
pub use crate::native::font::*;
pub use crate::runtime::font::*;
}
pub mod keyboard {
@ -242,7 +242,7 @@ pub mod subscription {
#[cfg(feature = "system")]
pub mod system {
//! Retrieve system information.
pub use crate::native::system::Information;
pub use crate::runtime::system::Information;
pub use crate::shell::system::*;
}

View file

@ -9,5 +9,4 @@ pub use position::Position;
pub use settings::Settings;
pub use crate::core::window::*;
pub use crate::native::window::*;
pub use crate::shell::window::*;
pub use crate::runtime::window::*;

View file

@ -17,10 +17,6 @@ rustc-hash = "1.1"
ouroboros = "0.15"
kurbo = "0.9"
[dependencies.iced_native]
version = "0.9"
path = "../native"
[dependencies.iced_graphics]
version = "0.7"
path = "../graphics"

View file

@ -187,7 +187,7 @@ impl Pipeline {
&self,
content: &str,
size: f32,
font: iced_native::Font,
font: Font,
bounds: Size,
point: Point,
_nearest_only: bool,

View file

@ -15,9 +15,9 @@ unicode-segmentation = "1.6"
num-traits = "0.2"
thiserror = "1"
[dependencies.iced_native]
[dependencies.iced_runtime]
version = "0.9"
path = "../native"
path = "../runtime"
[dependencies.iced_renderer]
version = "0.1"

View file

@ -5,12 +5,12 @@ use crate::container::{self, Container};
use crate::core;
use crate::core::widget::operation;
use crate::core::{Element, Length, Pixels};
use crate::native::Command;
use crate::overlay;
use crate::pick_list::{self, PickList};
use crate::progress_bar::{self, ProgressBar};
use crate::radio::{self, Radio};
use crate::rule::{self, Rule};
use crate::runtime::Command;
use crate::scrollable::{self, Scrollable};
use crate::slider::{self, Slider};
use crate::text::{self, Text};

View file

@ -14,10 +14,10 @@
)]
#![forbid(unsafe_code, rust_2018_idioms)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)]
pub use iced_native as native;
pub use iced_native::core;
pub use iced_renderer as renderer;
pub use iced_renderer::graphics;
pub use iced_runtime as runtime;
pub use iced_runtime::core;
pub use iced_style as style;
mod column;

View file

@ -13,7 +13,7 @@ use crate::core::{
Background, Clipboard, Color, Element, Layout, Length, Pixels, Point,
Rectangle, Shell, Size, Vector, Widget,
};
use crate::native::Command;
use crate::runtime::Command;
pub use crate::style::scrollable::{Scrollbar, Scroller, StyleSheet};
pub use operation::scrollable::RelativeOffset;

View file

@ -28,7 +28,7 @@ use crate::core::{
Clipboard, Color, Element, Layout, Length, Padding, Pixels, Point,
Rectangle, Shell, Size, Vector, Widget,
};
use crate::native::Command;
use crate::runtime::Command;
pub use iced_style::text_input::{Appearance, StyleSheet};

View file

@ -13,7 +13,7 @@ categories = ["gui"]
[features]
trace = ["tracing", "tracing-core", "tracing-subscriber"]
chrome-trace = ["trace", "tracing-chrome"]
debug = ["iced_native/debug"]
debug = ["iced_runtime/debug"]
system = ["sysinfo"]
application = []
@ -27,9 +27,9 @@ version = "0.27"
git = "https://github.com/iced-rs/winit.git"
rev = "940457522e9fb9f5dac228b0ecfafe0138b4048c"
[dependencies.iced_native]
[dependencies.iced_runtime]
version = "0.9"
path = "../native"
path = "../runtime"
[dependencies.iced_graphics]
version = "0.7"

View file

@ -16,10 +16,10 @@ use crate::core::{Event, Size};
use crate::futures::futures;
use crate::futures::{Executor, Runtime, Subscription};
use crate::graphics::compositor::{self, Compositor};
use crate::native::clipboard;
use crate::native::program::Program;
use crate::native::user_interface::{self, UserInterface};
use crate::native::{Command, Debug};
use crate::runtime::clipboard;
use crate::runtime::program::Program;
use crate::runtime::user_interface::{self, UserInterface};
use crate::runtime::{Command, Debug};
use crate::style::application::{Appearance, StyleSheet};
use crate::{Clipboard, Error, Proxy, Settings};
@ -709,9 +709,9 @@ pub fn run_command<A, E>(
E: Executor,
<A::Renderer as core::Renderer>::Theme: StyleSheet,
{
use iced_native::command;
use iced_native::system;
use iced_native::window;
use crate::runtime::command;
use crate::runtime::system;
use crate::runtime::window;
for action in command.actions() {
match action {

View file

@ -3,7 +3,7 @@ use crate::conversion;
use crate::core;
use crate::core::{Color, Point, Size};
use crate::graphics::Viewport;
use crate::native::Debug;
use crate::runtime::Debug;
use crate::Application;
use std::marker::PhantomData;

View file

@ -1,6 +1,4 @@
//! Access the clipboard.
use crate::native::clipboard::Action;
use crate::native::command::{self, Command};
/// A buffer for short-term storage and transfer within and between
/// applications.
@ -64,15 +62,3 @@ impl crate::core::Clipboard for Clipboard {
self.write(contents)
}
}
/// Read the current contents of the clipboard.
pub fn read<Message>(
f: impl Fn(Option<String>) -> Message + 'static,
) -> Command<Message> {
Command::single(command::Action::Clipboard(Action::Read(Box::new(f))))
}
/// Write the given contents to the clipboard.
pub fn write<Message>(contents: String) -> Command<Message> {
Command::single(command::Action::Clipboard(Action::Write(contents)))
}

View file

@ -31,9 +31,9 @@
#![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_cfg))]
pub use iced_graphics as graphics;
pub use iced_native as native;
pub use iced_native::core;
pub use iced_native::futures;
pub use iced_runtime as runtime;
pub use iced_runtime::core;
pub use iced_runtime::futures;
pub use iced_style as style;
pub use winit;
@ -42,7 +42,6 @@ pub mod application;
pub mod clipboard;
pub mod conversion;
pub mod settings;
pub mod window;
#[cfg(feature = "system")]
pub mod system;

View file

@ -1,7 +1,7 @@
//! Access the native system.
use crate::graphics::compositor;
use crate::native::command::{self, Command};
use crate::native::system::{Action, Information};
use crate::runtime::command::{self, Command};
use crate::runtime::system::{Action, Information};
/// Query for available system information.
pub fn fetch_information<Message>(