pub struct CommandBlocksWidget {
pub blocks: Vec<CommandBlock>,
pub selected_block: Option<usize>,
pub scroll: usize,
pub last_copy_result: Option<Result<CopyActionType, String>>,
}Expand description
Command blocks widget
Fields§
§blocks: Vec<CommandBlock>Blocks in the widget
selected_block: Option<usize>Selected block index
scroll: usizeScroll offset
last_copy_result: Option<Result<CopyActionType, String>>Last copy action result
Implementations§
Source§impl CommandBlocksWidget
impl CommandBlocksWidget
Sourcepub fn add_block(&mut self, block: CommandBlock)
pub fn add_block(&mut self, block: CommandBlock)
Add a block
Sourcepub fn select_next_block(&mut self)
pub fn select_next_block(&mut self)
Select next block
Sourcepub fn select_prev_block(&mut self)
pub fn select_prev_block(&mut self)
Select previous block
Sourcepub fn get_selected_block(&self) -> Option<&CommandBlock>
pub fn get_selected_block(&self) -> Option<&CommandBlock>
Get the selected block
Sourcepub fn get_selected_block_mut(&mut self) -> Option<&mut CommandBlock>
pub fn get_selected_block_mut(&mut self) -> Option<&mut CommandBlock>
Get the selected block (mutable)
Sourcepub fn toggle_selected_block_collapsed(&mut self)
pub fn toggle_selected_block_collapsed(&mut self)
Toggle selected block collapsed state
Sourcepub fn total_commands(&self) -> usize
pub fn total_commands(&self) -> usize
Get total number of commands across all blocks
Sourcepub fn total_success(&self) -> usize
pub fn total_success(&self) -> usize
Get total number of successful commands
Sourcepub fn total_failed(&self) -> usize
pub fn total_failed(&self) -> usize
Get total number of failed commands
Sourcepub fn total_running(&self) -> usize
pub fn total_running(&self) -> usize
Get total number of running commands
Sourcepub fn copy_selected_block(
&mut self,
action_type: CopyActionType,
) -> Result<(), String>
pub fn copy_selected_block( &mut self, action_type: CopyActionType, ) -> Result<(), String>
Copy selected block content
Sourcepub fn copy_all_blocks(&mut self) -> Result<(), String>
pub fn copy_all_blocks(&mut self) -> Result<(), String>
Copy all blocks content
Sourcepub fn copy_block_by_index(
&mut self,
block_idx: usize,
action_type: CopyActionType,
) -> Result<(), String>
pub fn copy_block_by_index( &mut self, block_idx: usize, action_type: CopyActionType, ) -> Result<(), String>
Copy block by index
Sourcepub fn get_last_copy_result(&self) -> Option<&Result<CopyActionType, String>>
pub fn get_last_copy_result(&self) -> Option<&Result<CopyActionType, String>>
Get the last copy result
Sourcepub fn clear_copy_result(&mut self)
pub fn clear_copy_result(&mut self)
Clear the last copy result
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CommandBlocksWidget
impl RefUnwindSafe for CommandBlocksWidget
impl Send for CommandBlocksWidget
impl Sync for CommandBlocksWidget
impl Unpin for CommandBlocksWidget
impl UnwindSafe for CommandBlocksWidget
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more