pub struct DefaultDelegate {
pub show_description: bool,
pub styles: DefaultItemStyles,
pub update_func: Option<Box<dyn Fn(&dyn Msg, &Model) -> Cmd + Send + Sync>>,
pub short_help_func: Option<Box<dyn Fn() -> Vec<Binding> + Send + Sync>>,
pub full_help_func: Option<Box<dyn Fn() -> Vec<Vec<Binding>> + Send + Sync>>,
/* private fields */
}Expand description
DefaultDelegate is a standard delegate designed to work in lists. It’s
styled by DefaultItemStyles, which can be customized as you like.
The description line can be hidden by setting show_description to
false, which renders the list as single-line-items. The spacing between
items can be set with the set_spacing method.
Fields§
§show_description: boolWhether to show the description line.
styles: DefaultItemStylesThe styles for the delegate.
update_func: Option<Box<dyn Fn(&dyn Msg, &Model) -> Cmd + Send + Sync>>An optional update function called on item updates.
short_help_func: Option<Box<dyn Fn() -> Vec<Binding> + Send + Sync>>An optional short help function.
full_help_func: Option<Box<dyn Fn() -> Vec<Vec<Binding>> + Send + Sync>>An optional full help function.
Implementations§
Source§impl DefaultDelegate
impl DefaultDelegate
Sourcepub fn set_height(&mut self, i: usize)
pub fn set_height(&mut self, i: usize)
SetHeight sets delegate’s preferred height.
Sourcepub fn height(&self) -> usize
pub fn height(&self) -> usize
Height returns the delegate’s preferred height. This has effect only if ShowDescription is true, otherwise height is always 1.
Sourcepub fn set_spacing(&mut self, i: usize)
pub fn set_spacing(&mut self, i: usize)
SetSpacing sets the delegate’s spacing.
Trait Implementations§
Source§impl ItemDelegate for DefaultDelegate
impl ItemDelegate for DefaultDelegate
Source§fn render(&self, m: &Model, index: usize, item: &dyn Item) -> String
fn render(&self, m: &Model, index: usize, item: &dyn Item) -> String
Render renders the item’s view.
Source§fn spacing(&self) -> usize
fn spacing(&self) -> usize
Spacing is the size of the horizontal gap between list items in
cells.
Source§fn update(&self, msg: &dyn Msg, m: &Model) -> Cmd
fn update(&self, msg: &dyn Msg, m: &Model) -> Cmd
Update is the update loop for items. All messages in the list’s
update loop will pass through here except when the user is setting a
filter. Use this method to perform item-level updates appropriate to
this delegate. Read more
Source§fn short_help(&self) -> Vec<Binding>
fn short_help(&self) -> Vec<Binding>
ShortHelp returns bindings for the short help view, if the delegate
implements the help keymap interface.
Auto Trait Implementations§
impl !RefUnwindSafe for DefaultDelegate
impl !UnwindSafe for DefaultDelegate
impl Freeze for DefaultDelegate
impl Send for DefaultDelegate
impl Sync for DefaultDelegate
impl Unpin for DefaultDelegate
impl UnsafeUnpin for DefaultDelegate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more