#![allow(clippy::type_complexity)]
use super::*;
use crate::construct::*;
use bevy::ecs::system::EntityCommands;
use std::fmt::Debug;
pub trait AskyEntityCommands<'w> {
fn prompt<T: Construct + Bundle + Submitter>(
self,
props: impl Into<T::Props>,
) -> EntityCommands<'w>
where
<T as Construct>::Props: Send,
<T as Submitter>::Out: Clone + Debug + Send + Sync;
}
pub trait AskyCommands {
fn prompt<T: Construct + Bundle + Submitter>(
&mut self,
props: impl Into<T::Props>,
dest: impl Into<Dest>,
) -> EntityCommands<'_>
where
<T as Construct>::Props: Send,
<T as Submitter>::Out: Clone + Debug + Send + Sync;
}
impl<'w> AskyEntityCommands<'w> for EntityCommands<'w> {
fn prompt<T: Construct + Bundle + Submitter>(
mut self,
props: impl Into<T::Props>,
) -> EntityCommands<'w>
where
<T as Construct>::Props: Send,
<T as Submitter>::Out: Clone + Debug + Send + Sync,
{
let p = props.into();
self.construct::<T>(p);
self
}
}
impl AskyCommands for Commands<'_, '_> {
fn prompt<T: Construct + Bundle + Submitter>(
&mut self,
props: impl Into<T::Props>,
dest: impl Into<Dest>,
) -> EntityCommands<'_>
where
<T as Construct>::Props: Send,
<T as Submitter>::Out: Clone + Debug + Send + Sync,
{
let p = props.into();
let d = dest.into();
let mut commands = d.entity(self);
commands.construct::<T>(p);
commands
}
}