Skip to content
Merged
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
14 changes: 12 additions & 2 deletions packages/iocraft/src/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ enum RenderLoopFutureState<'a, E: ElementExt> {
ignore_ctrl_c: bool,
element: &'a mut E,
},
Running(Pin<Box<dyn Future<Output = io::Result<()>> + 'a>>),
Running(Pin<Box<dyn Future<Output = io::Result<()>> + Send + 'a>>),
}

/// A future that renders an element in a loop, allowing it to be dynamic and interactive.
Expand Down Expand Up @@ -344,7 +344,7 @@ impl<'a, E: ElementExt + 'a> RenderLoopFuture<'a, E> {
}
}

impl<'a, E: ElementExt + 'a> Future for RenderLoopFuture<'a, E> {
impl<'a, E: ElementExt + Send + 'a> Future for RenderLoopFuture<'a, E> {
type Output = io::Result<()>;

fn poll(
Expand Down Expand Up @@ -473,6 +473,7 @@ where
#[cfg(test)]
mod tests {
use crate::prelude::*;
use futures::Future;

#[allow(clippy::unnecessary_mut_passed)]
#[test]
Expand Down Expand Up @@ -501,4 +502,13 @@ mod tests {
any_element_ref.print();
any_element_ref.eprint();
}

#[test]
fn test_render_loop_future() {
fn assert_send<F: Future + Send>(_f: F) {}

let mut element = element!(View);
let render_loop_future = element.render_loop();
assert_send(render_loop_future);
}
}