Daemon

Struct Daemon 

Source
pub struct Daemon<P: Program> { /* private fields */ }
Expand description

The underlying definition and configuration of an iced daemon.

You can use this API to create and run iced applications step by step—without coupling your logic to a trait or a specific type.

You can create a Daemon with the daemon helper.

Implementations§

Source§

impl<P: Program> Daemon<P>

Source

pub fn run(self) -> Result
where Self: 'static, P::Message: MaybeDebug + MaybeClone,

Runs the Daemon.

Source

pub fn settings(self, settings: Settings) -> Self

Sets the Settings that will be used to run the Daemon.

Source

pub fn antialiasing(self, antialiasing: bool) -> Self

Sets the Settings::antialiasing of the Daemon.

Source

pub fn default_font(self, default_font: Font) -> Self

Sets the default Font of the Daemon.

Source

pub fn font(self, font: impl Into<Cow<'static, [u8]>>) -> Self

Adds a font to the list of fonts that will be loaded at the start of the Daemon.

Source

pub fn title( self, title: impl TitleFn<P::State>, ) -> Daemon<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>

Sets the title of the Daemon.

Source

pub fn subscription( self, f: impl Fn(&P::State) -> Subscription<P::Message>, ) -> Daemon<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>

Sets the subscription logic of the Daemon.

Source

pub fn theme( self, f: impl ThemeFn<P::State, P::Theme>, ) -> Daemon<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>

Sets the theme logic of the Daemon.

Source

pub fn style( self, f: impl Fn(&P::State, &P::Theme) -> Style, ) -> Daemon<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>

Sets the style logic of the Daemon.

Source

pub fn scale_factor( self, f: impl Fn(&P::State, Id) -> f32, ) -> Daemon<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>

Sets the scale factor of the Daemon.

Source

pub fn executor<E>( self, ) -> Daemon<impl Program<State = P::State, Message = P::Message, Theme = P::Theme>>
where E: Executor,

Sets the executor of the Daemon.

Source

pub fn presets( self, presets: impl IntoIterator<Item = Preset<P::State, P::Message>>, ) -> Self

Sets the boot presets of the Daemon.

Presets can be used to override the default booting strategy of your application during testing to create reproducible environments.

Trait Implementations§

Source§

impl<P: Debug + Program> Debug for Daemon<P>
where P::State: Debug, P::Message: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Program> Program for Daemon<P>

Source§

type State = <P as Program>::State

The state of the program.
Source§

type Message = <P as Program>::Message

The message of the program.
Source§

type Theme = <P as Program>::Theme

The theme of the program.
Source§

type Renderer = <P as Program>::Renderer

The renderer of the program.
Source§

type Executor = <P as Program>::Executor

The executor of the program.
Source§

fn name() -> &'static str

Returns the unique name of the Program.
Source§

fn settings(&self) -> Settings

Source§

fn window(&self) -> Option<Settings>

Source§

fn boot(&self) -> (Self::State, Task<Self::Message>)

Source§

fn update( &self, state: &mut Self::State, message: Self::Message, ) -> Task<Self::Message>

Source§

fn view<'a>( &self, state: &'a Self::State, window: Id, ) -> Element<'a, Self::Message, Self::Theme, Self::Renderer>

Source§

fn title(&self, state: &Self::State, window: Id) -> String

Source§

fn subscription(&self, state: &Self::State) -> Subscription<Self::Message>

Source§

fn theme(&self, state: &Self::State, window: Id) -> Option<Self::Theme>

Source§

fn style(&self, state: &Self::State, theme: &Self::Theme) -> Style

Source§

fn scale_factor(&self, state: &Self::State, window: Id) -> f32

Source§

fn presets(&self) -> &[Preset<Self::State, Self::Message>]

Auto Trait Implementations§

§

impl<P> Freeze for Daemon<P>
where P: Freeze,

§

impl<P> !RefUnwindSafe for Daemon<P>

§

impl<P> !Send for Daemon<P>

§

impl<P> !Sync for Daemon<P>

§

impl<P> Unpin for Daemon<P>
where P: Unpin,

§

impl<P> !UnwindSafe for Daemon<P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: 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>

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)

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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<State, Message> IntoBoot<State, Message> for State

Source§

fn into_boot(self) -> (State, Task<Message>)

Turns some type into the initial state of some Application.
Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeDebug for T
where T: Debug,