[][src]Struct woab::BuilderUtilizer

pub struct BuilderUtilizer<A, W, S> { /* fields omitted */ }

Context for utilizing a gtk::Builder and connecting it to he Actix world.

See woab::Factory for usage example.

Implementations

impl<A, W, S> BuilderUtilizer<A, W, S> where
    &'a Builder: TryInto<W>, 
[src]

pub fn widgets(&self) -> Result<W, <&Builder as TryInto<W>>::Error>[src]

Create a widgets struct (as defined by the W generic parameter of woab::Factory) and map the builder's widgets to its fields.

impl<A, W, S> BuilderUtilizer<A, W, S> where
    A: Actor<Context = Context<A>>,
    &'a Builder: TryInto<W>,
    S: BuilderSignal,
    A: StreamHandler<S>, 
[src]

pub fn actor(
    &self,
    make_actor: impl FnOnce(&mut A::Context, W) -> A
) -> Result<Addr<A>, <&Builder as TryInto<W>>::Error>
[src]

Create an Actix actor and connect it to the builder's widgets and signals.

make_actor is a function that receives the actor context and the widgets, and is responsible for constructing the actor struct with the widgets inside it. It can also be used for configuring and or showing the widgets GTK-wise (though this can also be handled by the actor afterwards)

impl<A, W, S> BuilderUtilizer<A, W, S> where
    S: BuilderSignal
[src]

pub fn stream_builder_signals(&self) -> Option<Receiver<S>>[src]

Create a stream (based on Tokio's MSPC) of signals that arrive from the builder.

  • The signals are all represented by the third generic parameter (S) of woab::Factory - if the builder sends signals not covered by S's variants they'll be ignored.
  • If the builder defines no signals, or if none of the signals it defines are covered by S, this method will return None. This is important because otherwise it would have returned a stream stream will be closed automatically for having no transmitters, which - by default - will make Actix close the actor.

pub fn connect_tagged_builder_signals<T, C, AA>(
    &self,
    ctx: &mut C,
    tag: T
) -> &Self where
    T: Clone + 'static,
    AA: Actor<Context = C>,
    C: AsyncContext<AA>,
    AA: StreamHandler<(T, S)>, 
[src]

Stream the signals generated by the builder to an actor represented by ctx, together with a tag.

When using the same actor to handle multiple copies of the same set of widgets (e.g. multiple GtkListBoxRows) the tag can be used to determine which copy generated the signal.

If multiple tagged signals are streamed to the same actor - which is the typical use case for tagged signals - StreamHandler::finished should be overridden to avoid stopping the actor when one instance of the widgets is removed!!!

Trait Implementations

impl<A, W, S> From<Builder> for BuilderUtilizer<A, W, S>[src]

Auto Trait Implementations

impl<A, W, S> RefUnwindSafe for BuilderUtilizer<A, W, S> where
    A: RefUnwindSafe,
    S: RefUnwindSafe,
    W: RefUnwindSafe

impl<A, W, S> !Send for BuilderUtilizer<A, W, S>

impl<A, W, S> !Sync for BuilderUtilizer<A, W, S>

impl<A, W, S> Unpin for BuilderUtilizer<A, W, S> where
    A: Unpin,
    S: Unpin,
    W: Unpin

impl<A, W, S> UnwindSafe for BuilderUtilizer<A, W, S> where
    A: UnwindSafe,
    S: UnwindSafe,
    W: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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