Cut down on macro nonsense

- InertAtomic replaced atomic_inert! for improved tooling support
- atomic_defaults! is easier to type out than to explain in a docstring
- Changed rustfmt config to better support tiny functions such as as_any
This commit is contained in:
2023-09-15 12:37:10 +01:00
parent 3c0056c2db
commit 0bcf10659b
73 changed files with 418 additions and 654 deletions

View File

@@ -11,14 +11,14 @@ use ordered_float::NotNan;
use crate::facade::{IntoSystem, System};
use crate::foreign::cps_box::{init_cps, CPSBox};
use crate::foreign::{Atomic, ExternError};
use crate::foreign::{Atomic, ExternError, InertAtomic};
use crate::interpreted::ExprInst;
use crate::interpreter::HandlerTable;
use crate::systems::codegen::call;
use crate::systems::stl::Boolean;
use crate::utils::poller::{PollEvent, Poller};
use crate::utils::unwrap_or;
use crate::{atomic_inert, define_fn, ConstTree, Interner};
use crate::{define_fn, ConstTree, Interner};
#[derive(Debug, Clone)]
struct Timer {
@@ -45,7 +45,9 @@ impl Debug for CancelTimer {
#[derive(Clone, Debug)]
struct Yield;
atomic_inert!(Yield, typestr = "a yield command");
impl InertAtomic for Yield {
fn type_str() -> &'static str { "a yield command" }
}
/// Error indicating a yield command when all event producers and timers had
/// exited
@@ -109,15 +111,11 @@ impl<'a> AsynchSystem<'a> {
/// Obtain a message port for sending messages to the main thread. If an
/// object is passed to the MessagePort that does not have a handler, the
/// main thread panics.
pub fn get_port(&self) -> MessagePort {
MessagePort(self.sender.clone())
}
pub fn get_port(&self) -> MessagePort { MessagePort(self.sender.clone()) }
}
impl<'a> Default for AsynchSystem<'a> {
fn default() -> Self {
Self::new()
}
fn default() -> Self { Self::new() }
}
impl<'a> IntoSystem<'a> for AsynchSystem<'a> {