guigui64 / stybulate

Tabulate with Style
Apache License 2.0
18 stars 3 forks source link

Lib not Send? #13

Open MTRNord opened 3 years ago

MTRNord commented 3 years ago

Describe the bug Hi I am running this inside of a tokio thread. So it is async. It works when I dont create Cells inside of a for loop over a vec but as soon as I do that to generate the contents array I run into error[E0277]:dyn stybulate::Unstylecannot be sent between threads safely

To Reproduce Not easily possible. But basicly it is a tokio::spawn() with a for loop inside that iterates over a vec, creates the row vec and pushes this to a previously created vec which holds all vecs,

Expected behavior It shouldnt cause thread issues

Toolchain

Full Log:

error[E0277]: `dyn stybulate::Unstyle` cannot be sent between threads safely
   --> src/matrix/sync.rs:76:13
    |
76  |             tokio::spawn(async move {
    |             ^^^^^^^^^^^^ `dyn stybulate::Unstyle` cannot be sent between threads safely
    |
   ::: /home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.23/src/task/spawn.rs:127:21
    |
127 |         T: Future + Send + 'static,
    |                     ---- required by this bound in `tokio::spawn`
    |
    = help: the trait `std::marker::Send` is not implemented for `dyn stybulate::Unstyle`
    = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<dyn stybulate::Unstyle>`
    = note: required because it appears within the type `std::boxed::Box<dyn stybulate::Unstyle>`
    = note: required because it appears within the type `stybulate::Cell<'_>`
    = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<stybulate::Cell<'_>>`
    = note: required because it appears within the type `alloc::raw_vec::RawVec<stybulate::Cell<'_>>`
    = note: required because it appears within the type `std::vec::Vec<stybulate::Cell<'_>>`
    = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<std::vec::Vec<stybulate::Cell<'_>>>`
    = note: required because it appears within the type `alloc::raw_vec::RawVec<std::vec::Vec<stybulate::Cell<'_>>>`
    = note: required because it appears within the type `std::vec::Vec<std::vec::Vec<stybulate::Cell<'_>>>`
    = note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21> {std::future::ResumeTy, chrono::NaiveDate, command_parser::CommandParser<'r>, &'s mut command_parser::CommandParser<'t0>, &'t1 config::Config<'t2>, config::Config<'t3>, impl std::future::Future, (), sqlx::Pool<sqlx::Postgres>, &'t5 str, sqlx::postgres::PgArguments, sqlx::query::Query<'t6, sqlx::Postgres, sqlx::postgres::PgArguments>, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::query::Map<'t8, sqlx::Postgres, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::postgres::PgArguments>, &'t10 sqlx::Pool<sqlx::Postgres>, impl std::future::Future, std::vec::Vec<database::models::Time>, std::vec::Vec<std::vec::Vec<stybulate::Cell<'t19>>>, std::vec::Vec<std::vec::Vec<std::string::String>>, std::string::String, matrix_sdk::ruma_events::AnyMessageEventContent, &'t20 mut tokio::sync::mpsc::Sender<matrix_sdk::ruma_events::AnyMessageEventContent>, tokio::sync::mpsc::Sender<matrix_sdk::ruma_events::AnyMessageEventContent>, impl std::future::Future}`
    = note: required because it appears within the type `[static generator@src/command_parser/mod.rs:519:99: 579:6 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21> {std::future::ResumeTy, chrono::NaiveDate, command_parser::CommandParser<'r>, &'s mut command_parser::CommandParser<'t0>, &'t1 config::Config<'t2>, config::Config<'t3>, impl std::future::Future, (), sqlx::Pool<sqlx::Postgres>, &'t5 str, sqlx::postgres::PgArguments, sqlx::query::Query<'t6, sqlx::Postgres, sqlx::postgres::PgArguments>, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::query::Map<'t8, sqlx::Postgres, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::postgres::PgArguments>, &'t10 sqlx::Pool<sqlx::Postgres>, impl std::future::Future, std::vec::Vec<database::models::Time>, std::vec::Vec<std::vec::Vec<stybulate::Cell<'t19>>>, std::vec::Vec<std::vec::Vec<std::string::String>>, std::string::String, matrix_sdk::ruma_events::AnyMessageEventContent, &'t20 mut tokio::sync::mpsc::Sender<matrix_sdk::ruma_events::AnyMessageEventContent>, tokio::sync::mpsc::Sender<matrix_sdk::ruma_events::AnyMessageEventContent>, impl std::future::Future}]`
    = note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, std::vec::Vec<&'t0 str>, std::string::String, tracing::Span, [static generator@src/command_parser/mod.rs:519:99: 579:6 for<'t13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36> {std::future::ResumeTy, chrono::NaiveDate, command_parser::CommandParser<'t13>, &'t14 mut command_parser::CommandParser<'t15>, &'t16 config::Config<'t17>, config::Config<'t18>, impl std::future::Future, (), sqlx::Pool<sqlx::Postgres>, &'t20 str, sqlx::postgres::PgArguments, sqlx::query::Query<'t21, sqlx::Postgres, sqlx::postgres::PgArguments>, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::query::Map<'t23, sqlx::Postgres, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::postgres::PgArguments>, &'t25 sqlx::Pool<sqlx::Postgres>, impl std::future::Future, std::vec::Vec<database::models::Time>, std::vec::Vec<std::vec::Vec<stybulate::Cell<'t34>>>, std::vec::Vec<std::vec::Vec<std::string::String>>, std::string::String, matrix_sdk::ruma_events::AnyMessageEventContent, &'t35 mut tokio::sync::mpsc::Sender<matrix_sdk::ruma_events::AnyMessageEventContent>, tokio::sync::mpsc::Sender<matrix_sdk::ruma_events::AnyMessageEventContent>, impl std::future::Future}], impl std::future::Future, tracing_futures::Instrumented<impl std::future::Future>, ()}`
    = note: required because it appears within the type `[static generator@src/command_parser/mod.rs:518:5: 518:30 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, std::vec::Vec<&'t0 str>, std::string::String, tracing::Span, [static generator@src/command_parser/mod.rs:519:99: 579:6 for<'t13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36> {std::future::ResumeTy, chrono::NaiveDate, command_parser::CommandParser<'t13>, &'t14 mut command_parser::CommandParser<'t15>, &'t16 config::Config<'t17>, config::Config<'t18>, impl std::future::Future, (), sqlx::Pool<sqlx::Postgres>, &'t20 str, sqlx::postgres::PgArguments, sqlx::query::Query<'t21, sqlx::Postgres, sqlx::postgres::PgArguments>, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::query::Map<'t23, sqlx::Postgres, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::postgres::PgArguments>, &'t25 sqlx::Pool<sqlx::Postgres>, impl std::future::Future, std::vec::Vec<database::models::Time>, std::vec::Vec<std::vec::Vec<stybulate::Cell<'t34>>>, std::vec::Vec<std::vec::Vec<std::string::String>>, std::string::String, matrix_sdk::ruma_events::AnyMessageEventContent, &'t35 mut tokio::sync::mpsc::Sender<matrix_sdk::ruma_events::AnyMessageEventContent>, tokio::sync::mpsc::Sender<matrix_sdk::ruma_events::AnyMessageEventContent>, impl std::future::Future}], impl std::future::Future, tracing_futures::Instrumented<impl std::future::Future>, ()}]`
    = note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@src/command_parser/mod.rs:518:5: 518:30 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, std::vec::Vec<&'t0 str>, std::string::String, tracing::Span, [static generator@src/command_parser/mod.rs:519:99: 579:6 for<'t13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36> {std::future::ResumeTy, chrono::NaiveDate, command_parser::CommandParser<'t13>, &'t14 mut command_parser::CommandParser<'t15>, &'t16 config::Config<'t17>, config::Config<'t18>, impl std::future::Future, (), sqlx::Pool<sqlx::Postgres>, &'t20 str, sqlx::postgres::PgArguments, sqlx::query::Query<'t21, sqlx::Postgres, sqlx::postgres::PgArguments>, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::query::Map<'t23, sqlx::Postgres, [closure@/home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.4.1/src/macros.rs:519:9: 519:102], sqlx::postgres::PgArguments>, &'t25 sqlx::Pool<sqlx::Postgres>, impl std::future::Future, std::vec::Vec<database::models::Time>, std::vec::Vec<std::vec::Vec<stybulate::Cell<'t34>>>, std::vec::Vec<std::vec::Vec<std::string::String>>, std::string::String, matrix_sdk::ruma_events::AnyMessageEventContent, &'t35 mut tokio::sync::mpsc::Sender<matrix_sdk::ruma_events::AnyMessageEventContent>, tokio::sync::mpsc::Sender<matrix_sdk::ruma_events::AnyMessageEventContent>, impl std::future::Future}], impl std::future::Future, tracing_futures::Instrumented<impl std::future::Future>, ()}]>`
    = note: required because it appears within the type `impl std::future::Future`
    = note: required because it appears within the type `impl std::future::Future`
    = note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36, 't37, 't38, 't39, 't40> {std::future::ResumeTy, std::str::SplitWhitespace<'r>, &'s str, bool, &'t0 mut command_parser::CommandParser<'t1>, impl std::future::Future, (), impl std::future::Future, &'t8 std::string::String, std::string::String, impl std::future::Future, std::vec::Vec<&'t12 str>, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future}`
    = note: required because it appears within the type `[static generator@src/command_parser/mod.rs:616:34: 670:6 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36, 't37, 't38, 't39, 't40> {std::future::ResumeTy, std::str::SplitWhitespace<'r>, &'s str, bool, &'t0 mut command_parser::CommandParser<'t1>, impl std::future::Future, (), impl std::future::Future, &'t8 std::string::String, std::string::String, impl std::future::Future, std::vec::Vec<&'t12 str>, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future}]`
    = note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, std::string::String, tracing::Span, [static generator@src/command_parser/mod.rs:616:34: 670:6 for<'t9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36, 't37, 't38, 't39, 't40, 't41, 't42, 't43, 't44, 't45, 't46, 't47, 't48, 't49, 't50, 't51> {std::future::ResumeTy, std::str::SplitWhitespace<'t9>, &'t10 str, bool, &'t11 mut command_parser::CommandParser<'t12>, impl std::future::Future, (), impl std::future::Future, &'t19 std::string::String, std::string::String, impl std::future::Future, std::vec::Vec<&'t23 str>, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future}], impl std::future::Future, tracing_futures::Instrumented<impl std::future::Future>, ()}`
    = note: required because it appears within the type `[static generator@src/command_parser/mod.rs:610:5: 610:30 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, std::string::String, tracing::Span, [static generator@src/command_parser/mod.rs:616:34: 670:6 for<'t9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36, 't37, 't38, 't39, 't40, 't41, 't42, 't43, 't44, 't45, 't46, 't47, 't48, 't49, 't50, 't51> {std::future::ResumeTy, std::str::SplitWhitespace<'t9>, &'t10 str, bool, &'t11 mut command_parser::CommandParser<'t12>, impl std::future::Future, (), impl std::future::Future, &'t19 std::string::String, std::string::String, impl std::future::Future, std::vec::Vec<&'t23 str>, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future}], impl std::future::Future, tracing_futures::Instrumented<impl std::future::Future>, ()}]`
    = note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@src/command_parser/mod.rs:610:5: 610:30 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, std::string::String, tracing::Span, [static generator@src/command_parser/mod.rs:616:34: 670:6 for<'t9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36, 't37, 't38, 't39, 't40, 't41, 't42, 't43, 't44, 't45, 't46, 't47, 't48, 't49, 't50, 't51> {std::future::ResumeTy, std::str::SplitWhitespace<'t9>, &'t10 str, bool, &'t11 mut command_parser::CommandParser<'t12>, impl std::future::Future, (), impl std::future::Future, &'t19 std::string::String, std::string::String, impl std::future::Future, std::vec::Vec<&'t23 str>, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future, impl std::future::Future}], impl std::future::Future, tracing_futures::Instrumented<impl std::future::Future>, ()}]>`
    = note: required because it appears within the type `impl std::future::Future`
    = note: required because it appears within the type `impl std::future::Future`
    = note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, command_parser::CommandParser<'t0>, std::string::String, impl std::future::Future, (), std::result::Result<(), errors::ParseErrors>, errors::ParseErrors, &'t4 matrix_sdk::Client, matrix_sdk::Client, matrix_sdk::ruma_identifiers::RoomId, &'t5 matrix_sdk::ruma_identifiers::RoomId, matrix_sdk::ruma_events::room::message::MessageEventContent, matrix_sdk::ruma_events::AnyMessageEventContent, std::option::Option<matrix_sdk::uuid::Uuid>, impl std::future::Future}`
    = note: required because it appears within the type `[static generator@src/matrix/sync.rs:76:37: 97:14 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, command_parser::CommandParser<'t0>, std::string::String, impl std::future::Future, (), std::result::Result<(), errors::ParseErrors>, errors::ParseErrors, &'t4 matrix_sdk::Client, matrix_sdk::Client, matrix_sdk::ruma_identifiers::RoomId, &'t5 matrix_sdk::ruma_identifiers::RoomId, matrix_sdk::ruma_events::room::message::MessageEventContent, matrix_sdk::ruma_events::AnyMessageEventContent, std::option::Option<matrix_sdk::uuid::Uuid>, impl std::future::Future}]`
    = note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@src/matrix/sync.rs:76:37: 97:14 for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7> {std::future::ResumeTy, &'r mut command_parser::CommandParser<'s>, command_parser::CommandParser<'t0>, std::string::String, impl std::future::Future, (), std::result::Result<(), errors::ParseErrors>, errors::ParseErrors, &'t4 matrix_sdk::Client, matrix_sdk::Client, matrix_sdk::ruma_identifiers::RoomId, &'t5 matrix_sdk::ruma_identifiers::RoomId, matrix_sdk::ruma_events::room::message::MessageEventContent, matrix_sdk::ruma_events::AnyMessageEventContent, std::option::Option<matrix_sdk::uuid::Uuid>, impl std::future::Future}]>`
    = note: required because it appears within the type `impl std::future::Future`
guigui64 commented 3 years ago

Hello, it is unfortunately no longer possible for me to maintain this library. If by any chance you want to maintain it or know someone that would like to do it, please let me know!