Skip to main content

Spawn

Struct Spawn 

Source
pub struct Spawn { /* private fields */ }
Expand description

Tag: Spawns a Widget in the Text.

The Widget will be placed according to the DynSpawnSpecs, and should move automatically as the Spawn moves around the screen.

Implementations§

Source§

impl Spawn

Source

pub fn new(widget: impl Widget, specs: DynSpawnSpecs) -> Self

Returns a new instance of Spawn.

You can then place this Tag inside of the Text via Text::insert_tag or Tags::insert, and the Widget should be placed according to the DynSpawnSpecs, and should move around automatically reflecting where the Tag is at.

Do note that this Widget will only be added to Duat and be able to be printed to the screen once the Text itself is printed. And it will be removed once the RawTag within gets dropped, either by being removed from the Text, or by the Text itself being dropped.

[!NOTE]

For now, if you clone a Text with spawned Widgets within, those Widgets will not be cloned to the new Text, and the RawTag::SpawnedWidgets within will also be removed.

Trait Implementations§

Source§

impl Tag<Point> for Spawn

Source§

const IS_META: bool = false

A meta Tag is one that changes the layout of the Text itself. Read more
Source§

impl Tag<usize> for Spawn

Source§

const IS_META: bool = false

A meta Tag is one that changes the layout of the Text itself. Read more

Auto Trait Implementations§

§

impl Freeze for Spawn

§

impl !RefUnwindSafe for Spawn

§

impl Send for Spawn

§

impl !Sync for Spawn

§

impl Unpin for Spawn

§

impl UnsafeUnpin for Spawn

§

impl !UnwindSafe for Spawn

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<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.