Skip to main content

Fill

Trait Fill 

Source
pub trait Fill {
    // Required methods
    fn fill(
        &mut self,
        full_name: &str,
        key: Key,
        params: &Value,
        ui: &mut Ui<'_>,
    );
    fn finish(&mut self, ui: &mut Ui<'_>);

    // Provided method
    fn add(
        &mut self,
        namespace: &str,
        ext: Box<dyn Extension>,
    ) -> Result<OriginId, String> { ... }
}
Expand description

What fills slots: the runner’s extension list, or a test’s stand-in. A frame begun with Core::frame_with carries one; Ui::slot calls Fill::fill at the position the host declared, and Ui::finish calls Fill::finish once the host’s view is done.

Required Methods§

Source

fn fill(&mut self, full_name: &str, key: Key, params: &Value, ui: &mut Ui<'_>)

Fill the slot declared as full_name now, at the cursor, with key its key: for the extension it names, ui.fill(origin, slot, |ui| ext.view(slot, ui)), which is where the namespace and the bound come from.

Source

fn finish(&mut self, ui: &mut Ui<'_>)

After the host’s view: fill every ns/root the host did not declare, and warn about every slot an extension names that nothing declared this frame.

Provided Methods§

Source

fn add( &mut self, namespace: &str, ext: Box<dyn Extension>, ) -> Result<OriginId, String>

Loads ext under namespace, mid-frame, and answers with the origin it got — what a guest that hosts guests of its own calls (env.add_extension in Lua). It joins the same list as everyone else, so namespace has to be free of the host’s names too.

The default refuses: a Fill that is not a list of extensions has nowhere to put one.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<F> Fill for &mut F
where F: Fill + ?Sized,

Source§

fn fill(&mut self, full_name: &str, key: Key, params: &Value, ui: &mut Ui<'_>)

Source§

fn finish(&mut self, ui: &mut Ui<'_>)

Source§

fn add( &mut self, namespace: &str, ext: Box<dyn Extension>, ) -> Result<OriginId, String>

Source§

impl<F> Fill for Box<F>
where F: Fill + ?Sized,

Source§

fn fill(&mut self, full_name: &str, key: Key, params: &Value, ui: &mut Ui<'_>)

Source§

fn finish(&mut self, ui: &mut Ui<'_>)

Source§

fn add( &mut self, namespace: &str, ext: Box<dyn Extension>, ) -> Result<OriginId, String>

Implementors§

Source§

impl Fill for Extensions

The runner’s loop, as a Fill. A declared name is split at its last / into the namespace and the extension’s own slot name; the extension under that namespace fills it if it lists the name (or the name is "root" and it lists none). A view that errors leaves its message in the tree (red, where the fill would have been) and raises extension-view-error, once per extension and slot.