Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ pub mod batcher;

pub struct Launcher<Cushion, UIT, UIContext>
where
UIT: UI<Context = UIContext>,
UIT: UI<Cushion, Context = UIContext>,
UIContext: Send,
Cushion: Sync + Send,
Cushion: Sync + Send + 'static,
{
batcher: Batcher<Cushion, UIContext>,

Expand All @@ -24,7 +24,7 @@ where

impl<Cushion, UIT, UIContext> Default for Launcher<Cushion, UIT, UIContext>
where
UIT: UI<Context = UIContext>,
UIT: UI<Cushion, Context = UIContext>,
UIContext: Send,
Cushion: Sync + Send,
{
Expand All @@ -51,7 +51,7 @@ where
/// as the transformer function
impl<Cushion, UIT, UIContext> Launcher<Cushion, UIT, UIContext>
where
UIT: UI<Context = UIContext>,
UIT: UI<Cushion, Context = UIContext>,
UIContext: Send,
Cushion: Send + Sync + 'static,
{
Expand Down
4 changes: 2 additions & 2 deletions src/ui.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use color_eyre::Result;

pub trait UI {
pub trait UI<Cushion: Send + Sync + 'static> {
type Context;

fn run<Cushion: Send>(
fn run(
&self,
batcher: crate::launcher::batcher::Batcher<Cushion, Self::Context>,
) -> impl std::future::Future<Output = Result<Option<Cushion>>> + Send;
Expand Down
8 changes: 3 additions & 5 deletions tests/dummyui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,15 @@ where
}
}

impl<T, F> UI for DummyUI<T, F>
impl<T, F, Cushion> UI<Cushion> for DummyUI<T, F>
where
T: Sync + Send,
F: Fn(&T) + Sync,
Cushion: Send + Sync + 'static,
{
type Context = T;

async fn run<Cushion: Send>(
&self,
mut batcher: Batcher<Cushion, Self::Context>,
) -> Result<Option<Cushion>> {
async fn run(&self, mut batcher: Batcher<Cushion, Self::Context>) -> Result<Option<Cushion>> {
let mut more = true;
let mut buf: Buffer<(T, usize)> = Buffer::default();

Expand Down