Skip to content

Commit

Permalink
fix: document
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Dec 3, 2024
1 parent 599cb4b commit 6c66520
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions iced_layershell/src/build_pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use iced::{Font, Pixels};

use crate::settings::{LayerShellSettings, VirtualKeyboardSettings};

/// The renderer of some [`Program`].
/// The renderer of some Program.
pub trait Renderer: iced_core::text::Renderer + iced_graphics::compositor::Default {}

impl<T> Renderer for T where T: iced_core::text::Renderer + iced_graphics::compositor::Default {}
Expand All @@ -21,7 +21,7 @@ pub struct MainSettings {

/// settings for layer shell
pub layer_settings: LayerShellSettings,
/// The data needed to initialize an [`Application`].
/// The data needed to initialize an Application
///
/// The fonts to load on boot.
pub fonts: Vec<Cow<'static, [u8]>>,
Expand Down
42 changes: 21 additions & 21 deletions iced_sessionlock/src/build_pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::borrow::Cow;

use iced::{Font, Pixels};

/// The renderer of some [`Program`].
/// The renderer of iced program.
pub trait Renderer: iced_core::text::Renderer + iced_graphics::compositor::Default {}

impl<T> Renderer for T where T: iced_core::text::Renderer + iced_graphics::compositor::Default {}
Expand All @@ -15,7 +15,7 @@ pub struct MainSettings {
/// communicate with it through the windowing system.
pub id: Option<String>,

/// The data needed to initialize an [`Application`].
/// The data needed to initialize an Application.
///
/// The fonts to load on boot.
pub fonts: Vec<Cow<'static, [u8]>>,
Expand Down Expand Up @@ -87,7 +87,7 @@ mod pattern {
type Theme: Default + DefaultStyle;

/// Initializes the [`Application`] with the flags provided to
/// [`run`] as part of the [`Settings`].
/// run as part of the [`Settings`].
///
/// Here is where you should return the initial state of your app.
///
Expand Down Expand Up @@ -133,14 +133,14 @@ mod pattern {
theme.default_style()
}

/// Returns the event [`Subscription`] for the current state of the
/// Returns the event [`iced::Subscription`] for the current state of the
/// application.
///
/// A [`Subscription`] will be kept alive as long as you keep returning it,
/// A [`iced::Subscription`] will be kept alive as long as you keep returning it,
/// and the __messages__ produced will be handled by
/// [`update`](#tymethod.update).
/// [`Program::update`](#tymethod.update).
///
/// By default, this method returns an empty [`Subscription`].
/// By default, this method returns an empty [`iced::Subscription`].
fn subscription(&self, _state: &Self::State) -> iced::Subscription<Self::Message> {
iced::Subscription::none()
}
Expand Down Expand Up @@ -315,15 +315,15 @@ mod pattern {
}
}
#[derive(Debug)]
pub struct SingleApplication<A: Program> {
pub struct Application<A: Program> {
raw: A,
settings: MainSettings,
}

pub fn application<State, Message, Theme, Renderer>(
update: impl Update<State, Message>,
view: impl for<'a> self::View<'a, State, Message, Theme, Renderer>,
) -> SingleApplication<impl Program<Message = Message, Theme = Theme, State = State>>
) -> Application<impl Program<Message = Message, Theme = Theme, State = State>>
where
State: 'static,
Message: 'static + TryInto<UnLockAction, Error = Message> + Send + std::fmt::Debug,
Expand Down Expand Up @@ -370,7 +370,7 @@ mod pattern {
self.view.view(state, window).into()
}
}
SingleApplication {
Application {
raw: Instance {
update,
view,
Expand Down Expand Up @@ -688,7 +688,7 @@ mod pattern {
}
}

impl<P: Program> SingleApplication<P> {
impl<P: Program> Application<P> {
pub fn run(self) -> Result
where
Self: 'static,
Expand Down Expand Up @@ -740,9 +740,9 @@ mod pattern {
pub fn style(
self,
f: impl Fn(&P::State, &P::Theme) -> crate::Appearance,
) -> SingleApplication<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>
) -> Application<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>
{
SingleApplication {
Application {
raw: with_style(self.raw, f),
settings: self.settings,
}
Expand All @@ -751,9 +751,9 @@ mod pattern {
pub fn subscription(
self,
f: impl Fn(&P::State) -> iced::Subscription<P::Message>,
) -> SingleApplication<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>
) -> Application<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>
{
SingleApplication {
Application {
raw: with_subscription(self.raw, f),
settings: self.settings,
}
Expand All @@ -763,9 +763,9 @@ mod pattern {
pub fn theme(
self,
f: impl Fn(&P::State) -> P::Theme,
) -> SingleApplication<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>
) -> Application<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>
{
SingleApplication {
Application {
raw: with_theme(self.raw, f),
settings: self.settings,
}
Expand All @@ -775,21 +775,21 @@ mod pattern {
pub fn scale_factor(
self,
f: impl Fn(&P::State, iced_core::window::Id) -> f64,
) -> SingleApplication<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>
) -> Application<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>
{
SingleApplication {
Application {
raw: with_scale_factor(self.raw, f),
settings: self.settings,
}
}
/// Sets the executor of the [`Application`].
pub fn executor<E>(
self,
) -> SingleApplication<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>
) -> Application<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>
where
E: iced_futures::Executor,
{
SingleApplication {
Application {
raw: with_executor::<P, E>(self.raw),
settings: self.settings,
}
Expand Down

0 comments on commit 6c66520

Please sign in to comment.