Skip to content

Commit

Permalink
remove lifetimes from System trait
Browse files Browse the repository at this point in the history
  • Loading branch information
ezpuzz committed Jan 30, 2021
1 parent 39d4f58 commit 8d50874
Show file tree
Hide file tree
Showing 88 changed files with 195 additions and 163 deletions.
2 changes: 1 addition & 1 deletion amethyst_animation/src/skinning/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use super::resources::*;
#[derive(Debug, Default)]
pub struct VertexSkinningSystem;

impl System<'_> for VertexSkinningSystem {
impl System for VertexSkinningSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
let mut updated = HashSet::new();
let mut updated_skins = HashSet::new();
Expand Down
2 changes: 1 addition & 1 deletion amethyst_animation/src/systems/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub(crate) struct AnimationControlSystem<
next_id: u64,
}

impl<I, T> System<'static> for AnimationControlSystem<I, T>
impl<I, T> System for AnimationControlSystem<I, T>
where
I: std::fmt::Debug + PartialEq + Eq + Hash + Copy + Send + Sync + 'static,
T: AnimationSampling + Clone + std::fmt::Debug,
Expand Down
2 changes: 1 addition & 1 deletion amethyst_animation/src/systems/sampling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub(crate) struct SamplerInterpolationSystem<T: AnimationSampling> {
_marker: PhantomData<T>,
}

impl<T> System<'_> for SamplerInterpolationSystem<T>
impl<T> System for SamplerInterpolationSystem<T>
where
T: AnimationSampling + std::fmt::Debug,
{
Expand Down
2 changes: 1 addition & 1 deletion amethyst_assets/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ pub fn create_asset_type<Intermediate, Asset, ProcessorSystem>() -> AssetType
where
Asset: 'static + TypeUuid + Send + Sync,
for<'a> Intermediate: 'static + Deserialize<'a> + TypeUuid + Send,
ProcessorSystem: System<'static> + Default + 'static,
ProcessorSystem: System + Default + 'static,
{
log::debug!("Creating asset type: {:x?}", Asset::UUID);
AssetType {
Expand Down
2 changes: 1 addition & 1 deletion amethyst_assets/src/prefab/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Prefab {
#[derive(Default)]
struct PrefabProcessorSystem;

impl System<'static> for PrefabProcessorSystem {
impl System for PrefabProcessorSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("PrefabProcessorSystem")
Expand Down
2 changes: 1 addition & 1 deletion amethyst_assets/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct AssetProcessorSystem<A> {
_marker: PhantomData<A>,
}

impl<A> System<'_> for AssetProcessorSystem<A>
impl<A> System for AssetProcessorSystem<A>
where
A: Asset + ProcessableAsset,
{
Expand Down
2 changes: 1 addition & 1 deletion amethyst_audio/src/systems/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct AudioSystem;
#[derive(Debug, Default)]
pub struct SelectedListener(pub Option<Entity>);

impl System<'_> for AudioSystem {
impl System for AudioSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("AudioSystem")
Expand Down
2 changes: 1 addition & 1 deletion amethyst_audio/src/systems/dj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ where
_phantom: std::marker::PhantomData<R>,
}

impl<F, R> System<'static> for DjSystem<F, R>
impl<F, R> System for DjSystem<F, R>
where
F: FnMut(&mut R) -> Option<SourceHandle> + Send + Sync + 'static,
R: Send + Sync + 'static,
Expand Down
8 changes: 4 additions & 4 deletions amethyst_controls/src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct FlyMovementSystem {
pub(crate) longitudinal_axis: Option<Cow<'static, str>>,
}

impl System<'static> for FlyMovementSystem {
impl System for FlyMovementSystem {
fn build(self) -> Box<dyn systems::ParallelRunnable> {
Box::new(
SystemBuilder::new("FlyMovementSystem")
Expand Down Expand Up @@ -65,7 +65,7 @@ impl System<'static> for FlyMovementSystem {
#[derive(Debug)]
pub struct ArcBallRotationSystem;

impl System<'_> for ArcBallRotationSystem {
impl System for ArcBallRotationSystem {
fn build(self) -> Box<dyn systems::ParallelRunnable> {
Box::new(
SystemBuilder::new("ArcBallRotationSystem")
Expand Down Expand Up @@ -121,7 +121,7 @@ pub struct FreeRotationSystem {
pub(crate) reader: ReaderId<Event<'static, ()>>,
}

impl System<'static> for FreeRotationSystem {
impl System for FreeRotationSystem {
fn build(mut self) -> Box<dyn systems::ParallelRunnable> {
Box::new(
SystemBuilder::new("FreeRotationSystem")
Expand Down Expand Up @@ -165,7 +165,7 @@ pub struct MouseFocusUpdateSystem {
pub(crate) reader: ReaderId<Event<'static, ()>>,
}

impl System<'static> for MouseFocusUpdateSystem {
impl System for MouseFocusUpdateSystem {
fn build(mut self) -> Box<dyn systems::ParallelRunnable> {
Box::new(
SystemBuilder::new("MouseFocusUpdateSystem")
Expand Down
8 changes: 4 additions & 4 deletions amethyst_core/src/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ pub trait SystemBundle {
}

/// A System builds a ParallelRunnable for the Dispatcher
pub trait System<'a> {
pub trait System {
/// builds the Runnable part of System
fn build(self) -> Box<dyn ParallelRunnable + 'static>;
}

impl<'a, T, R> System<'a> for T
impl<T, R> System for T
where
T: FnOnce() -> R,
R: ParallelRunnable + 'static,
Expand Down Expand Up @@ -89,7 +89,7 @@ pub struct DispatcherBuilder {

impl<'a> DispatcherBuilder {
/// Adds a system to the schedule.
pub fn add_system<S: System<'a> + 'a>(&mut self, system: S) -> &mut Self {
pub fn add_system<S: System + 'a>(&mut self, system: S) -> &mut Self {
log::debug!("Building system");
self.items.push(DispatcherItem::System(system.build()));
self
Expand Down Expand Up @@ -230,7 +230,7 @@ pub mod tests {

struct MySystem;

impl System<'_> for MySystem {
impl System for MySystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("test")
Expand Down
2 changes: 1 addition & 1 deletion amethyst_core/src/hide_hierarchy_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
#[derive(Debug)]
pub struct HideHierarchySystem;

impl System<'_> for HideHierarchySystem {
impl System for HideHierarchySystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("HideHierarchySystem")
Expand Down
4 changes: 2 additions & 2 deletions amethyst_core/src/system_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use legion::{
///
/// struct TestSystem;
///
/// impl System<'_> for TestSystem {
/// impl System for TestSystem {
/// fn build(self) -> Box<dyn ParallelRunnable> {
/// Box::new(pausable(
/// SystemBuilder::new("TestSystem")
Expand Down Expand Up @@ -164,7 +164,7 @@ mod test {

struct TestSystem;

impl System<'_> for TestSystem {
impl System for TestSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(pausable(
SystemBuilder::new("TestSystem")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::ecs::*;
#[derive(Debug)]
pub struct MissingPreviousParentSystem;

impl System<'_> for MissingPreviousParentSystem {
impl System for MissingPreviousParentSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("MissingPreviousParentSystem")
Expand Down
2 changes: 1 addition & 1 deletion amethyst_core/src/transform/parent_update_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::ecs::*;
#[derive(Debug)]
pub struct ParentUpdateSystem;

impl System<'_> for ParentUpdateSystem {
impl System for ParentUpdateSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("ParentUpdateSystem")
Expand Down
2 changes: 1 addition & 1 deletion amethyst_core/src/transform/transform_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::ecs::*;
#[derive(Debug)]
pub struct TransformSystem;

impl System<'_> for TransformSystem {
impl System for TransformSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("TransformSystem")
Expand Down
2 changes: 1 addition & 1 deletion amethyst_input/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct InputSystem {
pub(crate) reader: ReaderId<Event<'static, ()>>,
}

impl System<'static> for InputSystem {
impl System for InputSystem {
fn build(mut self) -> Box<dyn systems::ParallelRunnable> {
Box::new(
SystemBuilder::new("InputSystem")
Expand Down
2 changes: 1 addition & 1 deletion amethyst_network/src/simulation/timing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const DEFAULT_SIM_FRAME_RATE: u32 = 30;
/// This system is used exclusively to update the state of the `NetworkSimulationTime` resource.
pub struct NetworkSimulationTimeSystem;

impl System<'_> for NetworkSimulationTimeSystem {
impl System for NetworkSimulationTimeSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("NetworkSimulationTimeSystem")
Expand Down
6 changes: 3 additions & 3 deletions amethyst_network/src/simulation/transport/laminar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl SystemBundle for LaminarNetworkBundle {
/// Creates a new laminar network send system.
pub struct LaminarNetworkSendSystem;

impl System<'_> for LaminarNetworkSendSystem {
impl System for LaminarNetworkSendSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("LaminarNetworkSendSystem")
Expand Down Expand Up @@ -129,7 +129,7 @@ impl System<'_> for LaminarNetworkSendSystem {
/// Creates a new laminar network poll system.
pub struct LaminarNetworkPollSystem;

impl System<'_> for LaminarNetworkPollSystem {
impl System for LaminarNetworkPollSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("LaminarNetworkPollSystem")
Expand All @@ -146,7 +146,7 @@ impl System<'_> for LaminarNetworkPollSystem {
/// Creates a new laminar receive system.
pub struct LaminarNetworkRecvSystem;

impl System<'_> for LaminarNetworkRecvSystem {
impl System for LaminarNetworkRecvSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("LaminarNetworkRecvSystem")
Expand Down
8 changes: 4 additions & 4 deletions amethyst_network/src/simulation/transport/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl SystemBundle for TcpNetworkBundle {
pub struct TcpStreamManagementSystem;

#[allow(clippy::map_entry)]
impl System<'_> for TcpStreamManagementSystem {
impl System for TcpStreamManagementSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("TcpStreamManagementSystem")
Expand Down Expand Up @@ -114,7 +114,7 @@ impl System<'_> for TcpStreamManagementSystem {
/// System to listen for incoming connections and cache them to the resource.
pub struct TcpConnectionListenerSystem;

impl System<'_> for TcpConnectionListenerSystem {
impl System for TcpConnectionListenerSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("TcpConnectionListenerSystem")
Expand Down Expand Up @@ -154,7 +154,7 @@ impl System<'_> for TcpConnectionListenerSystem {
/// System to send messages to a particular open `TcpStream`.
pub struct TcpNetworkSendSystem;

impl System<'_> for TcpNetworkSendSystem {
impl System for TcpNetworkSendSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("TcpNetworkSendSystem")
Expand Down Expand Up @@ -205,7 +205,7 @@ fn write_message(
/// System to receive messages from all open `TcpStream`s.
pub struct TcpNetworkRecvSystem;

impl System<'_> for TcpNetworkRecvSystem {
impl System for TcpNetworkRecvSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("TcpNetworkRecvSystem")
Expand Down
4 changes: 2 additions & 2 deletions amethyst_network/src/simulation/transport/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl SystemBundle for UdpNetworkBundle {
/// Creates a new network simulation time system.
pub struct UdpNetworkSendSystem;

impl System<'_> for UdpNetworkSendSystem {
impl System for UdpNetworkSendSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("UdpNetworkSendSystem")
Expand Down Expand Up @@ -87,7 +87,7 @@ impl System<'_> for UdpNetworkSendSystem {
/// Creates a new udp network receiver system
pub struct UdpNetworkReceiveSystem;

impl System<'_> for UdpNetworkReceiveSystem {
impl System for UdpNetworkReceiveSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("UdpNetworkReceiveSystem")
Expand Down
2 changes: 1 addition & 1 deletion amethyst_rendy/src/sprite_visibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct Internals {
#[derive(Debug)]
pub struct SpriteVisibilitySortingSystem;

impl System<'_> for SpriteVisibilitySortingSystem {
impl System for SpriteVisibilitySortingSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
let mut transparent_centroids: Vec<Internals> = Vec::default();

Expand Down
4 changes: 2 additions & 2 deletions amethyst_rendy/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ pub struct MeshProcessorSystem<B: Backend> {
pub(crate) _marker: std::marker::PhantomData<B>,
}

impl<B: Backend> System<'_> for MeshProcessorSystem<B> {
impl<B: Backend> System for MeshProcessorSystem<B> {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("MeshProcessorSystem")
Expand Down Expand Up @@ -186,7 +186,7 @@ pub struct TextureProcessorSystem<B> {
pub(crate) _marker: std::marker::PhantomData<B>,
}

impl<B: Backend> System<'_> for TextureProcessorSystem<B> {
impl<B: Backend> System for TextureProcessorSystem<B> {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("TextureProcessorSystem")
Expand Down
2 changes: 1 addition & 1 deletion amethyst_rendy/src/visibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub struct VisibilitySortingSystem {
transparent: Vec<Internals>,
}

impl System<'static> for VisibilitySortingSystem {
impl System for VisibilitySortingSystem {
fn build(mut self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("VisibilitySortingSystem")
Expand Down
2 changes: 1 addition & 1 deletion amethyst_ui/src/blink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct Blink {
#[derive(Debug)]
pub struct BlinkSystem;

impl System<'_> for BlinkSystem {
impl System for BlinkSystem {
fn build(self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("BlinkSystem")
Expand Down
2 changes: 1 addition & 1 deletion amethyst_ui/src/button/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl UiButtonSystem {
}
}

impl System<'static> for UiButtonSystem {
impl System for UiButtonSystem {
fn build(mut self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("UiButtonSystem")
Expand Down
2 changes: 1 addition & 1 deletion amethyst_ui/src/drag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl DragWidgetSystem {
}
}

impl System<'static> for DragWidgetSystem {
impl System for DragWidgetSystem {
fn build(mut self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("DragWidgetSystem")
Expand Down
2 changes: 1 addition & 1 deletion amethyst_ui/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl UiMouseSystem {
}
}

impl System<'static> for UiMouseSystem {
impl System for UiMouseSystem {
fn build(mut self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("UiMouseSystem")
Expand Down
2 changes: 1 addition & 1 deletion amethyst_ui/src/event_retrigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ where
}
}

impl<T: EventRetrigger + 'static> System<'static> for EventRetriggerSystem<T> {
impl<T: EventRetrigger + 'static> System for EventRetriggerSystem<T> {
fn build(mut self) -> Box<dyn ParallelRunnable> {
let system_name = format!("{}System", std::any::type_name::<T>());
Box::new(
Expand Down
4 changes: 2 additions & 2 deletions amethyst_ui/src/glyphs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pub(crate) struct GlyphTextureProcessorSystem<B> {
pub(crate) _marker: std::marker::PhantomData<B>,
}

impl<B: Backend> System<'static> for GlyphTextureProcessorSystem<B> {
impl<B: Backend> System for GlyphTextureProcessorSystem<B> {
fn build(self) -> Box<dyn ParallelRunnable> {
use hal::format::{Component as C, Swizzle};

Expand Down Expand Up @@ -181,7 +181,7 @@ impl<B: Backend> System<'static> for GlyphTextureProcessorSystem<B> {
}
}

impl<B: Backend> System<'static> for UiGlyphsSystem<B> {
impl<B: Backend> System for UiGlyphsSystem<B> {
fn build(mut self) -> Box<dyn ParallelRunnable> {
Box::new(
SystemBuilder::new("UiGlyphsSystem")
Expand Down
Loading

0 comments on commit 8d50874

Please sign in to comment.