pub struct ListBuilder { /* private fields */ }Expand description
ListBuilder is used to create List instances using the builder pattern.
This allows for a flexible and readable way to construct List with different
options by chaining method calls.
§Example
ListBuilder::new()
.header(...)?
.default_flags(...)?
.number()
.build();Implementations§
Source§impl ListBuilder
impl ListBuilder
Sourcepub fn header_expl(self, header: Header) -> Self
pub fn header_expl(self, header: Header) -> Self
Explicitly sets a Header component for the List. Unlike the header
method, which takes a label and internally constructs a Header, this
method allows you to directly provide a preconstructed Header component.
§Parameters
header: AHeadercomponent.
§Returns
ListBuilder: Returnsself.
§Example
// Create a `Header` component.
let header = Header::new(...)?;
// Set a preconstructed `Header` component.
ListBuilder::new()
.header_expl(header);Sourcepub fn header(self, label: &str) -> FtuiResult<Self>
pub fn header(self, label: &str) -> FtuiResult<Self>
Sourcepub fn default_flags(self, flags: TextFlags) -> FtuiResult<Self>
pub fn default_flags(self, flags: TextFlags) -> FtuiResult<Self>
Sets the default TextFlags to be used when adding elements to the List.
§Parameters
flags: TheTextFlagsto apply to elements unless explicitly overridden.
§Returns
Ok(ListBuilder): Returnsself.Err(FtuiError): Returns an error.
§Example
// Set a default red color for all elements added to the list, unless overridden.
ListBuilder::new()
.default_flags(tui::TextFlags::COLOR_RED)?;Sourcepub fn build(self) -> List
pub fn build(self) -> List
Finalizes the construction of a List. This method should be called
after all desired options have been set using the builder pattern.
It consumes self and returns the completed List.
§Returns
List: Returns the createdList.
§Example
ListBuilder::new()
.header(...)?
.default_flags(...)?
.number()
.build(); // Finalize and retrieve the constructed list.Auto Trait Implementations§
impl Freeze for ListBuilder
impl RefUnwindSafe for ListBuilder
impl Send for ListBuilder
impl Sync for ListBuilder
impl Unpin for ListBuilder
impl UnsafeUnpin for ListBuilder
impl UnwindSafe for ListBuilder
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