AmbientRun / Ambient

The multiplayer game engine
https://ambient.run
Apache License 2.0
3.79k stars 122 forks source link

How can we improve the workflow for `pipeline.toml` and `ambient.toml`? #524

Open chaosprint opened 1 year ago

chaosprint commented 1 year ago

So far syntax like:

[[pipelines]]
type = "Models"

is hard to write.

Perhaps it's better to make an interactive CLI tool like this:

ambient assets new

What kind of pipeline do you wish to add? Select with space.
- [x] model
- [ ] audio
- [ ] images
Please input your asset URL:
(you can drag and drop to your terminal to get the URL)
(if the file not in the project/assets folder, the file will be copied there)

This may also apply to new components with CLI tools like ambient component new:

My top pain points:

FredrikNoren commented 1 year ago

We used to have a ui for the pipelines before, and it's quite easy to add again. Here's what needs to be done:

  1. Add an ambient edit-pipelines command
  2. Add ElementEditor to all the type in pipeline_types (see auto_editor example
  3. In that mode, don't render the normal client, but instead render all the pipelines using the automatic editors

There's some nuance here too; we need to re-implement an editor for AssetUrls, (probably a file picker), and this UI would need to support showing a file list for the assets so you can create pipelines in different directories. So it's a bit of work to get it all working.

ten3roberts commented 1 year ago

Do you feel that the errors have regressed a lot since before adding the "improved error reporting"

What is the error for when you mistype?

There is some limitations in the serde toml parser due to maturity where errors don't have the same amount of context or line information as other formats, but after #444 these errors should be more descriptive than the previous data did not match any variant of PipelinesOneOrMany.

chaosprint commented 1 year ago

yes, it's better.

The errors I mentioned are some legacy issues I encountered with ambient.toml before:

For example, if we mistype the component type I32 to i32, we get:

 ~/Dev/afpsmod  ambient run                                                                                                                         101 ✘  at 04:22:01 PM 
[2023-06-21T14:22:07Z INFO  ambient] Building project "afpsmod"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Unsupported type"', crates/build/src/lib.rs:42:87
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

If the type typo is inside the messages, that will become a really prolonged and confusing one:

 ~/Dev/afpsmod  ambient run                                                                                                                         101 ✘  at 04:22:07 PM 
[2023-06-21T14:24:33Z INFO  ambient] Building project "afpsmod"
Error: Failed to build project

Caused by:
    0: Failed to build rust "/Users/chaosprint/Dev/afpsmod/build"
    1: failed to compile, stdout: error: custom attribute panicked
         --> src/mods/player/client.rs:13:1
          |
       13 | #[main]
          | ^^^^^^^
          |
          = help: message: called `Result::unwrap()` on an `Err` value: invalid primitive type

                  Stack backtrace:
                     0: backtrace::backtrace::libunwind::trace
                               at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.67/src/backtrace/libunwind.rs:93:5
                        backtrace::backtrace::trace_unsynchronized
                               at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.67/src/backtrace/mod.rs:66:5
                     1: backtrace::backtrace::trace
                               at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.67/src/backtrace/mod.rs:53:14
                     2: anyhow::backtrace::capture::Backtrace::create
                               at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.71/src/backtrace.rs:216:13
                     3: anyhow::backtrace::capture::Backtrace::capture
                               at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.71/src/backtrace.rs:204:17
                     4: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
                               at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.71/src/error.rs:547:25
                     5: <core::result::Result<T,F> as core::ops::try_trait::FromResidual<core::result::Result<core::convert::Infallible,E>>>::from_residual
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:2002:27
                     6: ambient_project_macro_common::message::to_token_stream::{{closure}}
                               at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:70:26
                     7: ambient_project_macro_common::util::tree_to_token_stream
                               at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/util.rs:97:40
                     8: ambient_project_macro_common::message::to_token_stream
                               at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:45:5
                     9: ambient_project_macro_common::message::to_token_stream::{{closure}}
                               at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:49:19
                    10: ambient_project_macro_common::util::tree_to_token_stream::{{closure}}
                               at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/util.rs:41:30
                    11: core::iter::adapters::map::map_try_fold::{{closure}}
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/map.rs:91:28
                    12: core::iter::traits::iterator::Iterator::try_fold
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:2304:21
                    13: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/map.rs:117:9
                    14: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::try_fold
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/mod.rs:195:9
                    15: core::iter::traits::iterator::Iterator::try_for_each
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:2366:9
                        <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::next
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/mod.rs:178:14
                    16: alloc::vec::Vec<T,A>::extend_desugared
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/mod.rs:2812:35
                    17: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/spec_extend.rs:17:9
                    18: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/spec_from_iter_nested.rs:43:9
                    19: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/in_place_collect.rs:167:20
                    20: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/mod.rs:2712:9
                    21: core::iter::traits::iterator::Iterator::collect
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:1896:9
                        <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter::{{closure}}
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:1969:51
                    22: core::iter::adapters::try_process
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/mod.rs:164:17
                    23: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:1969:9
                    24: core::iter::traits::iterator::Iterator::collect
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:1896:9
                    25: ambient_project_macro_common::util::tree_to_token_stream
                               at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/util.rs:39:26
                    26: ambient_project_macro_common::message::to_token_stream
                               at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:45:5
                    27: ambient_project_macro_common::message::tree_to_token_stream
                               at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:20:5
                    28: ambient_project_macro_common::generate_code
                               at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/lib.rs:79:26
                    29: ambient_api_macros::main_macro::main_impl
                               at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/guest/rust/api_core/api_macros/src/main_macro.rs:16:31
                    30: ambient_api_macros::main
                               at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/guest/rust/api_core/api_macros/src/lib.rs:33:5
                    31: core::ops::function::Fn::call
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:79:5
                    32: proc_macro::bridge::client::Client<(proc_macro::TokenStream,proc_macro::TokenStream),proc_macro::TokenStream>::expand2::{{closure}}::{{closure}}
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:450:21
                    33: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}::{{closure}}
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:399:30
                    34: proc_macro::bridge::scoped_cell::ScopedCell<T>::set::{{closure}}
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/scoped_cell.rs:79:33
                    35: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/scoped_cell.rs:74:9
                    36: proc_macro::bridge::scoped_cell::ScopedCell<T>::set
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/scoped_cell.rs:79:9
                    37: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:398:13
                    38: std::thread::local::LocalKey<T>::try_with
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/thread/local.rs:252:16
                    39: std::thread::local::LocalKey<T>::with
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/thread/local.rs:228:9
                    40: proc_macro::bridge::client::run_client::{{closure}}
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:397:9
                    41: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panic/unwind_safe.rs:271:9
                    42: std::panicking::try::do_call
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:485:40
                    43: ___rust_try
                    44: std::panicking::try
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:449:19
                    45: std::panic::catch_unwind
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panic.rs:140:14
                    46: proc_macro::bridge::client::run_client
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:384:5
                    47: proc_macro::bridge::client::Client<(proc_macro::TokenStream,proc_macro::TokenStream),proc_macro::TokenStream>::expand2::{{closure}}
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:449:17
                    48: proc_macro::bridge::selfless_reify::reify_to_extern_c_fn_hrt_bridge::wrapper
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/selfless_reify.rs:64:17
                    49: <proc_macro::bridge::server::MaybeCrossThread<rustc_expand::proc_macro::CrossbeamMessagePipe<proc_macro::bridge::buffer::Buffer>> as proc_macro::bridge::server::ExecutionStrategy>::run_bridge_and_client::<proc_macro::bridge::server::Dispatcher<proc_macro::bridge::server::MarkedTypes<rustc_expand::proc_macro_server::Rustc>>>
                    50: proc_macro::bridge::server::run_server::<rustc_expand::proc_macro_server::Rustc, (proc_macro::bridge::Marked<rustc_ast::tokenstream::TokenStream, proc_macro::bridge::client::TokenStream>, proc_macro::bridge::Marked<rustc_ast::tokenstream::TokenStream, proc_macro::bridge::client::TokenStream>), core::option::Option<proc_macro::bridge::Marked<rustc_ast::tokenstream::TokenStream, proc_macro::bridge::client::TokenStream>>, proc_macro::bridge::server::MaybeCrossThread<rustc_expand::proc_macro::CrossbeamMessagePipe<proc_macro::bridge::buffer::Buffer>>>
                    51: <proc_macro::bridge::client::Client<(proc_macro::TokenStream, proc_macro::TokenStream), proc_macro::TokenStream>>::run::<rustc_expand::proc_macro_server::Rustc, proc_macro::bridge::server::MaybeCrossThread<rustc_expand::proc_macro::CrossbeamMessagePipe<proc_macro::bridge::buffer::Buffer>>>
                    52: <rustc_expand::proc_macro::AttrProcMacro as rustc_expand::base::AttrProcMacro>::expand
                    53: <rustc_expand::expand::MacroExpander>::fully_expand_fragment
                    54: <rustc_expand::expand::MacroExpander>::expand_crate
                    55: <rustc_session::session::Session>::time::<rustc_ast::ast::Crate, rustc_interface::passes::configure_and_expand::{closure#1}>
                    56: rustc_interface::passes::resolver_for_lowering
                    57: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<rustc_query_system::query::plumbing::execute_job_incr<rustc_query_impl::queries::resolver_for_lowering, rustc_query_impl::plumbing::QueryCtxt>::{closure#2}, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>::{closure#0}, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                    58: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::resolver_for_lowering, rustc_query_impl::plumbing::QueryCtxt>
                    59: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::resolver_for_lowering
                    60: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#2}, &rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::rc::Rc<rustc_ast::ast::Crate>)>>::{closure#0}, &rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::rc::Rc<rustc_ast::ast::Crate>)>>::{closure#0}, &rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::rc::Rc<rustc_ast::ast::Crate>)>>
                    61: <rustc_interface::queries::QueryResult<&rustc_middle::ty::context::GlobalCtxt>>::enter::<&rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::rc::Rc<rustc_ast::ast::Crate>)>, rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#2}>
                    62: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
                    63: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
                    64: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
                    65: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
                    66: std::sys::unix::thread::Thread::new::thread_start
                    67: __pthread_joiner_wake

       error: custom attribute panicked
        --> src/client.rs:3:1
         |
       3 | #[main]
         | ^^^^^^^
         |
         = help: message: called `Result::unwrap()` on an `Err` value: invalid primitive type

                 Stack backtrace:
                    0: backtrace::backtrace::libunwind::trace
                              at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.67/src/backtrace/libunwind.rs:93:5
                       backtrace::backtrace::trace_unsynchronized
                              at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.67/src/backtrace/mod.rs:66:5
                    1: backtrace::backtrace::trace
                              at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.67/src/backtrace/mod.rs:53:14
                    2: anyhow::backtrace::capture::Backtrace::create
                              at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.71/src/backtrace.rs:216:13
                    3: anyhow::backtrace::capture::Backtrace::capture
                              at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.71/src/backtrace.rs:204:17
                    4: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
                              at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.71/src/error.rs:547:25
                    5: <core::result::Result<T,F> as core::ops::try_trait::FromResidual<core::result::Result<core::convert::Infallible,E>>>::from_residual
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:2002:27
                    6: ambient_project_macro_common::message::to_token_stream::{{closure}}
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:70:26
                    7: ambient_project_macro_common::util::tree_to_token_stream
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/util.rs:97:40
                    8: ambient_project_macro_common::message::to_token_stream
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:45:5
                    9: ambient_project_macro_common::message::to_token_stream::{{closure}}
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:49:19
                   10: ambient_project_macro_common::util::tree_to_token_stream::{{closure}}
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/util.rs:41:30
                   11: core::iter::adapters::map::map_try_fold::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/map.rs:91:28
                   12: core::iter::traits::iterator::Iterator::try_fold
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:2304:21
                   13: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/map.rs:117:9
                   14: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::try_fold
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/mod.rs:195:9
                   15: core::iter::traits::iterator::Iterator::try_for_each
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:2366:9
                       <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::next
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/mod.rs:178:14
                   16: alloc::vec::Vec<T,A>::extend_desugared
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/mod.rs:2812:35
                   17: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/spec_extend.rs:17:9
                   18: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/spec_from_iter_nested.rs:43:9
                   19: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/in_place_collect.rs:167:20
                   20: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/mod.rs:2712:9
                   21: core::iter::traits::iterator::Iterator::collect
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:1896:9
                       <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:1969:51
                   22: core::iter::adapters::try_process
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/mod.rs:164:17
                   23: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:1969:9
                   24: core::iter::traits::iterator::Iterator::collect
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:1896:9
                   25: ambient_project_macro_common::util::tree_to_token_stream
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/util.rs:39:26
                   26: ambient_project_macro_common::message::to_token_stream
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:45:5
                   27: ambient_project_macro_common::message::tree_to_token_stream
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:20:5
                   28: ambient_project_macro_common::generate_code
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/lib.rs:79:26
                   29: ambient_api_macros::main_macro::main_impl
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/guest/rust/api_core/api_macros/src/main_macro.rs:16:31
                   30: ambient_api_macros::main
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/guest/rust/api_core/api_macros/src/lib.rs:33:5
                   31: core::ops::function::Fn::call
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:79:5
                   32: proc_macro::bridge::client::Client<(proc_macro::TokenStream,proc_macro::TokenStream),proc_macro::TokenStream>::expand2::{{closure}}::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:450:21
                   33: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:399:30
                   34: proc_macro::bridge::scoped_cell::ScopedCell<T>::set::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/scoped_cell.rs:79:33
                   35: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/scoped_cell.rs:74:9
                   36: proc_macro::bridge::scoped_cell::ScopedCell<T>::set
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/scoped_cell.rs:79:9
                   37: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:398:13
                   38: std::thread::local::LocalKey<T>::try_with
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/thread/local.rs:252:16
                   39: std::thread::local::LocalKey<T>::with
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/thread/local.rs:228:9
                   40: proc_macro::bridge::client::run_client::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:397:9
                   41: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panic/unwind_safe.rs:271:9
                   42: std::panicking::try::do_call
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:485:40
                   43: ___rust_try
                   44: std::panicking::try
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:449:19
                   45: std::panic::catch_unwind
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panic.rs:140:14
                   46: proc_macro::bridge::client::run_client
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:384:5
                   47: proc_macro::bridge::client::Client<(proc_macro::TokenStream,proc_macro::TokenStream),proc_macro::TokenStream>::expand2::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:449:17
                   48: proc_macro::bridge::selfless_reify::reify_to_extern_c_fn_hrt_bridge::wrapper
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/selfless_reify.rs:64:17
                   49: <proc_macro::bridge::server::MaybeCrossThread<rustc_expand::proc_macro::CrossbeamMessagePipe<proc_macro::bridge::buffer::Buffer>> as proc_macro::bridge::server::ExecutionStrategy>::run_bridge_and_client::<proc_macro::bridge::server::Dispatcher<proc_macro::bridge::server::MarkedTypes<rustc_expand::proc_macro_server::Rustc>>>
                   50: proc_macro::bridge::server::run_server::<rustc_expand::proc_macro_server::Rustc, (proc_macro::bridge::Marked<rustc_ast::tokenstream::TokenStream, proc_macro::bridge::client::TokenStream>, proc_macro::bridge::Marked<rustc_ast::tokenstream::TokenStream, proc_macro::bridge::client::TokenStream>), core::option::Option<proc_macro::bridge::Marked<rustc_ast::tokenstream::TokenStream, proc_macro::bridge::client::TokenStream>>, proc_macro::bridge::server::MaybeCrossThread<rustc_expand::proc_macro::CrossbeamMessagePipe<proc_macro::bridge::buffer::Buffer>>>
                   51: <proc_macro::bridge::client::Client<(proc_macro::TokenStream, proc_macro::TokenStream), proc_macro::TokenStream>>::run::<rustc_expand::proc_macro_server::Rustc, proc_macro::bridge::server::MaybeCrossThread<rustc_expand::proc_macro::CrossbeamMessagePipe<proc_macro::bridge::buffer::Buffer>>>
                   52: <rustc_expand::proc_macro::AttrProcMacro as rustc_expand::base::AttrProcMacro>::expand
                   53: <rustc_expand::expand::MacroExpander>::fully_expand_fragment
                   54: <rustc_expand::expand::MacroExpander>::expand_crate
                   55: <rustc_session::session::Session>::time::<rustc_ast::ast::Crate, rustc_interface::passes::configure_and_expand::{closure#1}>
                   56: rustc_interface::passes::resolver_for_lowering
                   57: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<rustc_query_system::query::plumbing::execute_job_incr<rustc_query_impl::queries::resolver_for_lowering, rustc_query_impl::plumbing::QueryCtxt>::{closure#2}, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>::{closure#0}, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   58: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::resolver_for_lowering, rustc_query_impl::plumbing::QueryCtxt>
                   59: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::resolver_for_lowering
                   60: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#2}, &rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::rc::Rc<rustc_ast::ast::Crate>)>>::{closure#0}, &rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::rc::Rc<rustc_ast::ast::Crate>)>>::{closure#0}, &rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::rc::Rc<rustc_ast::ast::Crate>)>>
                   61: <rustc_interface::queries::QueryResult<&rustc_middle::ty::context::GlobalCtxt>>::enter::<&rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::rc::Rc<rustc_ast::ast::Crate>)>, rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#2}>
                   62: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
                   63: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
                   64: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
                   65: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
                   66: std::sys::unix::thread::Thread::new::thread_start
                   67: __pthread_joiner_wake

       error: custom attribute panicked
        --> src/mods/first_person/client.rs:3:1
         |
       3 | #[main]
         | ^^^^^^^
         |
         = help: message: called `Result::unwrap()` on an `Err` value: invalid primitive type

                 Stack backtrace:
                    0: backtrace::backtrace::libunwind::trace
                              at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.67/src/backtrace/libunwind.rs:93:5
                       backtrace::backtrace::trace_unsynchronized
                              at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.67/src/backtrace/mod.rs:66:5
                    1: backtrace::backtrace::trace
                              at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.67/src/backtrace/mod.rs:53:14
                    2: anyhow::backtrace::capture::Backtrace::create
                              at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.71/src/backtrace.rs:216:13
                    3: anyhow::backtrace::capture::Backtrace::capture
                              at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.71/src/backtrace.rs:204:17
                    4: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
                              at /Users/chaosprint/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.71/src/error.rs:547:25
                    5: <core::result::Result<T,F> as core::ops::try_trait::FromResidual<core::result::Result<core::convert::Infallible,E>>>::from_residual
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:2002:27
                    6: ambient_project_macro_common::message::to_token_stream::{{closure}}
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:70:26
                    7: ambient_project_macro_common::util::tree_to_token_stream
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/util.rs:97:40
                    8: ambient_project_macro_common::message::to_token_stream
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:45:5
                    9: ambient_project_macro_common::message::to_token_stream::{{closure}}
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:49:19
                   10: ambient_project_macro_common::util::tree_to_token_stream::{{closure}}
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/util.rs:41:30
                   11: core::iter::adapters::map::map_try_fold::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/map.rs:91:28
                   12: core::iter::traits::iterator::Iterator::try_fold
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:2304:21
                   13: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/map.rs:117:9
                   14: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::try_fold
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/mod.rs:195:9
                   15: core::iter::traits::iterator::Iterator::try_for_each
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:2366:9
                       <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::next
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/mod.rs:178:14
                   16: alloc::vec::Vec<T,A>::extend_desugared
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/mod.rs:2812:35
                   17: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/spec_extend.rs:17:9
                   18: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/spec_from_iter_nested.rs:43:9
                   19: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/in_place_collect.rs:167:20
                   20: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/mod.rs:2712:9
                   21: core::iter::traits::iterator::Iterator::collect
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:1896:9
                       <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:1969:51
                   22: core::iter::adapters::try_process
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/mod.rs:164:17
                   23: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:1969:9
                   24: core::iter::traits::iterator::Iterator::collect
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:1896:9
                   25: ambient_project_macro_common::util::tree_to_token_stream
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/util.rs:39:26
                   26: ambient_project_macro_common::message::to_token_stream
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:45:5
                   27: ambient_project_macro_common::message::tree_to_token_stream
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/message.rs:20:5
                   28: ambient_project_macro_common::generate_code
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/shared_crates/project_macro_common/src/lib.rs:79:26
                   29: ambient_api_macros::main_macro::main_impl
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/guest/rust/api_core/api_macros/src/main_macro.rs:16:31
                   30: ambient_api_macros::main
                              at /Users/chaosprint/.cargo/git/checkouts/ambient-e153138232031f82/f7a5730/guest/rust/api_core/api_macros/src/lib.rs:33:5
                   31: core::ops::function::Fn::call
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:79:5
                   32: proc_macro::bridge::client::Client<(proc_macro::TokenStream,proc_macro::TokenStream),proc_macro::TokenStream>::expand2::{{closure}}::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:450:21
                   33: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:399:30
                   34: proc_macro::bridge::scoped_cell::ScopedCell<T>::set::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/scoped_cell.rs:79:33
                   35: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/scoped_cell.rs:74:9
                   36: proc_macro::bridge::scoped_cell::ScopedCell<T>::set
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/scoped_cell.rs:79:9
                   37: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:398:13
                   38: std::thread::local::LocalKey<T>::try_with
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/thread/local.rs:252:16
                   39: std::thread::local::LocalKey<T>::with
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/thread/local.rs:228:9
                   40: proc_macro::bridge::client::run_client::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:397:9
                   41: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panic/unwind_safe.rs:271:9
                   42: std::panicking::try::do_call
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:485:40
                   43: ___rust_try
                   44: std::panicking::try
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:449:19
                   45: std::panic::catch_unwind
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panic.rs:140:14
                   46: proc_macro::bridge::client::run_client
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:384:5
                   47: proc_macro::bridge::client::Client<(proc_macro::TokenStream,proc_macro::TokenStream),proc_macro::TokenStream>::expand2::{{closure}}
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/client.rs:449:17
                   48: proc_macro::bridge::selfless_reify::reify_to_extern_c_fn_hrt_bridge::wrapper
                              at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/proc_macro/src/bridge/selfless_reify.rs:64:17
                   49: <proc_macro::bridge::server::MaybeCrossThread<rustc_expand::proc_macro::CrossbeamMessagePipe<proc_macro::bridge::buffer::Buffer>> as proc_macro::bridge::server::ExecutionStrategy>::run_bridge_and_client::<proc_macro::bridge::server::Dispatcher<proc_macro::bridge::server::MarkedTypes<rustc_expand::proc_macro_server::Rustc>>>
                   50: proc_macro::bridge::server::run_server::<rustc_expand::proc_macro_server::Rustc, (proc_macro::bridge::Marked<rustc_ast::tokenstream::TokenStream, proc_macro::bridge::client::TokenStream>, proc_macro::bridge::Marked<rustc_ast::tokenstream::TokenStream, proc_macro::bridge::client::TokenStream>), core::option::Option<proc_macro::bridge::Marked<rustc_ast::tokenstream::TokenStream, proc_macro::bridge::client::TokenStream>>, proc_macro::bridge::server::MaybeCrossThread<rustc_expand::proc_macro::CrossbeamMessagePipe<proc_macro::bridge::buffer::Buffer>>>
                   51: <proc_macro::bridge::client::Client<(proc_macro::TokenStream, proc_macro::TokenStream), proc_macro::TokenStream>>::run::<rustc_expand::proc_macro_server::Rustc, proc_macro::bridge::server::MaybeCrossThread<rustc_expand::proc_macro::CrossbeamMessagePipe<proc_macro::bridge::buffer::Buffer>>>
                   52: <rustc_expand::proc_macro::AttrProcMacro as rustc_expand::base::AttrProcMacro>::expand
                   53: <rustc_expand::expand::MacroExpander>::fully_expand_fragment
                   54: <rustc_expand::expand::MacroExpander>::expand_crate
                   55: <rustc_session::session::Session>::time::<rustc_ast::ast::Crate, rustc_interface::passes::configure_and_expand::{closure#1}>
                   56: rustc_interface::passes::resolver_for_lowering
                   57: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<rustc_query_system::query::plumbing::execute_job_incr<rustc_query_impl::queries::resolver_for_lowering, rustc_query_impl::plumbing::QueryCtxt>::{closure#2}, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>::{closure#0}, (rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex)>
                   58: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::resolver_for_lowering, rustc_query_impl::plumbing::QueryCtxt>
                   59: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::resolver_for_lowering
                   60: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#2}, &rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::rc::Rc<rustc_ast::ast::Crate>)>>::{closure#0}, &rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::rc::Rc<rustc_ast::ast::Crate>)>>::{closure#0}, &rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::rc::Rc<rustc_ast::ast::Crate>)>>
                   61: <rustc_interface::queries::QueryResult<&rustc_middle::ty::context::GlobalCtxt>>::enter::<&rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::rc::Rc<rustc_ast::ast::Crate>)>, rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#2}>
                   62: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
                   63: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
                   64: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
                   65: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
                   66: std::sys::unix::thread::Thread::new::thread_start
                   67: __pthread_joiner_wake

       warning: unused imports: `AnimationPlayer`, `BindId`, `BlendNode`, `PlayClipFromUrlNode`, `add_child`, `add_component`, `animation::apply_animation_player`, `camera::aspect_ratio_from_window`, `element::to_owned`, `get_bone_by_bind_id`, `make_perspective_infinite_reverse_camera`, `make_sphere`, `make_transformable`, `model::model_loaded`, `prefab::prefab_from_url`, `primitives::quad`, `transform::reset_scale`, `wait_for_component`
        --> src/mods/player/client.rs:2:17
         |
       2 |     animation::{get_bone_by_bind_id, AnimationPlayer, BindId, BlendNode, PlayClipFromUrlNode},
         |                 ^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^  ^^^^^^  ^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^
       3 |     components::core::{
       4 |         animation::apply_animation_player, camera::aspect_ratio_from_window, model::model_loaded,
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^
       5 |         prefab::prefab_from_url, primitives::quad, transform::reset_scale,
         |         ^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^
       6 |     },
       7 |     concepts::{make_perspective_infinite_reverse_camera, make_sphere, make_transformable},
         |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^
       8 |     element::to_owned,
         |     ^^^^^^^^^^^^^^^^^
       9 |     entity::{add_child, add_component, wait_for_component},
         |              ^^^^^^^^^  ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^
         |
         = note: `#[warn(unused_imports)]` on by default

       error[E0601]: `main` function not found in crate `client_afpsmod`
        --> src/client.rs:4:17
         |
       4 | pub fn main() {}
         |                 ^ consider adding a `main` function to `src/client.rs`

       error[E0601]: `main` function not found in crate `mods_first_person_client`
         --> src/mods/first_person/client.rs:28:2
          |
       28 | }
          |  ^ consider adding a `main` function to `src/mods/first_person/client.rs`

       error: aborting due to 2 previous errors

       For more information about this error, try `rustc --explain E0601`.
       error: aborting due to 2 previous errors

       For more information about this error, try `rustc --explain E0601`.
       error[E0601]: `main` function not found in crate `mods_player_client`
         --> src/mods/player/client.rs:23:2
          |
       23 | }
          |  ^ consider adding a `main` function to `src/mods/player/client.rs`

       error: aborting due to 2 previous errors; 1 warning emitted

       For more information about this error, try `rustc --explain E0601`.
       , stderr:    Compiling afpsmod v0.0.1 (/Users/chaosprint/Dev/afpsmod)
       error: could not compile `afpsmod` (bin "client_afpsmod") due to 3 previous errors
       warning: build failed, waiting for other jobs to finish...
       error: could not compile `afpsmod` (bin "mods_first_person_client") due to 3 previous errors
       error: could not compile `afpsmod` (bin "mods_player_client") due to 3 previous errors; 1 warning emitted
philpax commented 1 year ago

The error situation is better in #417 (the types are resolved by the semantic system, so it can better report on errors). For manipulation of the actual embers and pipelines, I agree that it would be nice to have a more systematic approach to it.

The two proposals we've discussed internally are 1) CLI tooling, similar to what's described in this issue 2) an enhanced debugger/editor that lets you visually configure the project and pipelines

We'll see what we can do.

chaosprint commented 1 year ago

Before this is decided, I think it's better to add an empty pipeline.toml in the ./assets/ folder at the start template, with comments/docs inside, like this:

# -------------------------------
# Uncomment any "pipeline" that can suit your need
# This will create a pipeline for everything inside this folder FBX, GLB
# -------------------------------
# [[pipelines]]
# type = "Models"

# -------------------------------
# You can have multiple pipelines
# This is useful for processing things differently
# For example, you may want to use build-in colliders for some models only
# -------------------------------

# [[pipelines]]
# type = "Models"
# sources = ["maps/**/*"]

# [pipelines.collider]
# type = "FromModel"

# [[pipelines]]
# type = "Models"
# sources = ["animations/**/*"]

# -------------------------------
# Create another pipeline for audio
# convertion is false by default and optional
# -------------------------------

# [[pipelines]]
# type = "Audio"
# convert = true
# sources = ["sound/**/*"]

# -------------------------------
# This is for importing an material such as image
# Then in the Rust code, you can import the material like this
# You may need to use other numbers (not just 0) if you have multiple material to import
# ```rust
# .with(pbr_material_from_url(), asset::url("assets/pipeline.toml/0/mat.json").unwrap())
# ```
# -------------------------------

# [[pipelines]]
# type = "Materials"
# output_decals = false

# [pipelines.importer]
# type = "Single"
# name = "pic1"
# base_color = "pic1.jpeg"

@philpax how do you think? I think we need this "traffic sign". Otherwise, users will get confused, have to break the dev flow and try to find examples or docs.

philpax commented 1 year ago

That seems pretty reasonable - tooling would be nice, but it seems unlikely we'll be able to get that any time soon. Feel free to PR that up and I'll do clean-up and merge it in 👌