Skip to main content

TooltipAppender

Trait TooltipAppender 

pub trait TooltipAppender:
    Send
    + Sync
    + 'static {
    // Required method
    fn append(
        &self,
        host: &dyn ClientHost,
        stack: &ItemStack,
        context: &TooltipAppendContext,
        lines: &mut Vec<(Text, u32)>,
    );
}
Expand description

The lines a data component adds to its stack’s tooltip. Kept by the game from registration on; asked only for a stack that carries the component and whose tooltip_display shows it, and only while its mod is enabled. Multiple registrations for the same component all run.

Required Methods§

fn append( &self, host: &dyn ClientHost, stack: &ItemStack, context: &TooltipAppendContext, lines: &mut Vec<(Text, u32)>, )

Add lines to lines for stack, each with a colour as rgba packs it (u32::MAX keeps the text’s own). context is the tooltip’s player and flags.

Trait Implementations§

§

impl Wire for Box<dyn TooltipAppender>

§

const MIN: usize = 8

Minimum encoded size, used to reject impossible collection lengths.
§

fn put(&self, out: &mut Writer)

Encodes this value, recording failures on the writer.
§

fn put_owned(self, out: &mut Writer)

Consumes owned data when a resource’s ownership must cross the boundary.
§

fn take(input: &mut Reader<'_>) -> Result<Box<dyn TooltipAppender>, WireError>

Decodes one value, leaving any following bytes for the caller.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§