Trait tuig_ui::attachments::Attachment
source · pub trait Attachment<'s> {
type Output;
// Required method
fn attach(self, region: Region<'s>) -> Self::Output;
}
Expand description
Something that can be put into a Region
.
Deciding when to implement Attachment
– versus just fiddling with regions in the parent attachment – can be
difficult, like most software design problems. It’s a balancing act between the extra boilerplate and the extra
segmentation. Follow the single-responsibility principle, keep your code DRY, etc.
Implementing this trait directly will let you fiddle with Region
s and, generally, is the high-level interface.
If you need the lower-level interface to actually handle input and draw to the character grid, you’ll need to impl
RawAttachment
, or make use of FnOnce(Action, ScreenView)
implementing RawAttachment
.