pub trait LegendEntry<C: PixelColor> {
// Required methods
fn label(&self) -> &str;
fn set_label(&mut self, label: &str) -> ChartResult<()>;
fn entry_type(&self) -> &LegendEntryType<C>;
fn set_entry_type(&mut self, entry_type: LegendEntryType<C>);
fn is_visible(&self) -> bool;
fn set_visible(&mut self, visible: bool);
fn calculate_size(&self, style: &LegendStyle<C>) -> Size;
fn render_symbol<D>(
&self,
bounds: Rectangle,
style: &SymbolStyle<C>,
target: &mut D,
) -> ChartResult<()>
where D: DrawTarget<Color = C>;
}Expand description
Trait for individual legend entries
Required Methods§
Sourcefn set_label(&mut self, label: &str) -> ChartResult<()>
fn set_label(&mut self, label: &str) -> ChartResult<()>
Set the label text for this entry
Sourcefn entry_type(&self) -> &LegendEntryType<C>
fn entry_type(&self) -> &LegendEntryType<C>
Get the entry type (determines the symbol)
Sourcefn set_entry_type(&mut self, entry_type: LegendEntryType<C>)
fn set_entry_type(&mut self, entry_type: LegendEntryType<C>)
Set the entry type
Sourcefn is_visible(&self) -> bool
fn is_visible(&self) -> bool
Check if this entry is visible
Sourcefn set_visible(&mut self, visible: bool)
fn set_visible(&mut self, visible: bool)
Set the visibility of this entry
Sourcefn calculate_size(&self, style: &LegendStyle<C>) -> Size
fn calculate_size(&self, style: &LegendStyle<C>) -> Size
Calculate the required size for this entry
Sourcefn render_symbol<D>(
&self,
bounds: Rectangle,
style: &SymbolStyle<C>,
target: &mut D,
) -> ChartResult<()>where
D: DrawTarget<Color = C>,
fn render_symbol<D>(
&self,
bounds: Rectangle,
style: &SymbolStyle<C>,
target: &mut D,
) -> ChartResult<()>where
D: DrawTarget<Color = C>,
Render the symbol for this entry
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.