macro_rules! default_environment {
    ($env_name:ident, desktop
        $(,fields = [$($fname:ident : $fty:ty),* $(,)?])?
        $(,singles = [$($sty:ty => $sname: ident),* $(,)?])?
        $(,multis = [$($mty:ty => $mname:ident),* $(,)?])?
        $(,)?
    ) => { ... };
    ($env_name:ident
        $(,fields = [$($fname:ident : $fty:ty),* $(,)?])?
        $(,singles = [$($sty:ty => $sname:ident),* $(,)?])?
        $(,multis = [$($mty:ty => $mname:ident),* $(,)?])?
        $(,)?
    ) => { ... };
}
Expand description

Declare a batteries-included SCTK environment

Similar to the environment! macro, but creates the type for you and includes all the handlers provided by SCTK, for use with the rest of the library. Its sister macro new_default_environment! needs to be used to initialize it.

This includes handlers for the following globals:

If you don’t need to add anything more, using it is as simple as:

default_environment!(MyEnv);

The macro also provides some presets including more globals depending on your use-case:

  • the desktop preset, invoked as default_environment!(MyEnv, desktop); additionally includes:

You can also add the fields argument to add additional fields to the generated struct, and the singles and multis arguments to route additional globals like with the environment! macro. These three fields are optional, but they must appear in this order, and after the optional preset

default_environment!(MyEnv,
    desktop, // the chosen preset, can be ommited
    fields=[
        somefield: u32,
        otherfield: String,
    ],
    singles=[
        // Add some routing here
    ],
    multis=[
        // add some routing here
    ]
);