what do send

This commit is contained in:
jane 2021-12-28 21:10:00 -05:00
parent 78cf419e9b
commit 85cef5d474
3 changed files with 3 additions and 3 deletions

View file

@ -35,7 +35,7 @@ fn main() {
});
let pat_clone = Arc::clone(&pattern);
thread::spawn(|| loop {
thread::spawn(move || loop {
websocket(&pat_clone);
});

View file

@ -7,7 +7,7 @@ use std::sync::RwLockWriteGuard;
pub type ParseError = Box<dyn std::error::Error>;
pub trait Pattern {
pub trait Pattern: Send {
fn execute(&self, values: &mut RwLockWriteGuard<'_, [RawColor; crate::LED_SIZE]>);
fn parse(args: Vec<String>) -> Result<Self, ParseError> where Self: Sized;
}

View file

@ -7,7 +7,7 @@ pub fn websocket(pattern: &Arc<Mutex<Vec<Box<dyn Pattern>>>>) {
let server = TcpListener::bind("0.0.0.0:29999").unwrap();
for stream in server.incoming() {
let clone = Arc::clone(pattern);
thread::spawn (|| {
thread::spawn (move || {
let mut websocket = accept(stream.unwrap()).unwrap();
loop {
let input = websocket.read_message().unwrap();