Skip to content

Commit

Permalink
Rename iced_native to iced_runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Mar 5, 2023
1 parent 8af69be commit 99e0a71
Show file tree
Hide file tree
Showing 39 changed files with 87 additions and 97 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ members = [
"core",
"futures",
"graphics",
"native",
"runtime",
"renderer",
"style",
"tiny_skia",
Expand Down
2 changes: 1 addition & 1 deletion examples/integration/src/controls.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions examples/integration/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
23 changes: 0 additions & 23 deletions native/src/window.rs

This file was deleted.

2 changes: 1 addition & 1 deletion native/Cargo.toml → runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
File renamed without changes.
15 changes: 14 additions & 1 deletion native/src/clipboard.rs → runtime/src/clipboard.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Access the clipboard.
use iced_futures::MaybeSend;
use crate::command::{self, Command};
use crate::futures::MaybeSend;

use std::fmt;

Expand Down Expand Up @@ -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)))
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 12 additions & 12 deletions native/src/user_interface.rs → runtime/src/user_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`].
///
Expand All @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -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 = ();
/// # }
/// #
Expand All @@ -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();
Expand Down
28 changes: 24 additions & 4 deletions winit/src/window.rs → runtime/src/window.rs
Original file line number Diff line number Diff line change
@@ -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> {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/advanced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
}
2 changes: 1 addition & 1 deletion src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
{
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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::*;
}

Expand Down
3 changes: 1 addition & 2 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
4 changes: 0 additions & 4 deletions tiny_skia/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tiny_skia/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl Pipeline {
&self,
content: &str,
size: f32,
font: iced_native::Font,
font: Font,
bounds: Size,
point: Point,
_nearest_only: bool,
Expand Down
4 changes: 2 additions & 2 deletions widget/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion widget/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
4 changes: 2 additions & 2 deletions widget/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion widget/src/scrollable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion widget/src/text_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
6 changes: 3 additions & 3 deletions winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []

Expand All @@ -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"
Expand Down
14 changes: 7 additions & 7 deletions winit/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion winit/src/application/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 99e0a71

Please sign in to comment.