Skip to main content

Bound

Trait Bound 

Source
pub trait Bound:
    Copy
    + Send
    + Sync
    + 'static {
    const NAME: &'static str;
    const DOC: &'static str;
    const PARTS: &'static [&'static [Function<Self>]];

    // Required method
    fn resolve(load: &mut Load<'_>) -> Result<Self, Off>;

    // Provided method
    fn functions() -> impl Iterator<Item = &'static Function<Self>> { ... }
}
Available on crate feature unstable only.
Expand description

A part of the API a script reaches as one namespace, such as world.

§Examples

See Function.

Required Associated Constants§

Source

const NAME: &'static str

The namespace’s name in a script.

Source

const DOC: &'static str

What the namespace is for, one sentence.

Source

const PARTS: &'static [&'static [Function<Self>]]

The method lists of every #[script] block of the type.

Required Methods§

Source

fn resolve(load: &mut Load<'_>) -> Result<Self, Off>

The value a script’s calls go to, for the mod load initialises.

§Errors

Off when the game build lacks what the part needs; the script runs without that namespace.

Provided Methods§

Source

fn functions() -> impl Iterator<Item = &'static Function<Self>>

Every method a script may call.

§Examples
use enshwick::script::Bound;

assert!(enshwick::world::World::functions().any(|f| f.name() == "broadcast"));

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Bound for Inventories

Source§

const NAME: &'static str = "inventory"

Source§

const DOC: &'static str = "Inventories on the server: their slots and counts, and items given, taken and moved."

Source§

const PARTS: &'static [&'static [Function<Self>]]

Source§

impl Bound for Log

Source§

const NAME: &'static str = "log"

Source§

const DOC: &'static str = "The mod's log file, one line per call."

Source§

const PARTS: &'static [&'static [Function<Self>]]

Source§

impl Bound for Scheduler

Source§

const NAME: &'static str = "scheduler"

Source§

const DOC: &'static str = "Work for the server's game thread: on the next pass, after a delay, or repeatedly."

Source§

const PARTS: &'static [&'static [Function<Self>]]

Source§

impl Bound for World

Source§

const NAME: &'static str = "world"

Source§

const DOC: &'static str = "The server's world: players, chat, notices and positions. Unstable: may change in any release."

Source§

const PARTS: &'static [&'static [Function<Self>]]