CommandBlocksWidget

Struct CommandBlocksWidget 

Source
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: usize

Scroll offset

§last_copy_result: Option<Result<CopyActionType, String>>

Last copy action result

Implementations§

Source§

impl CommandBlocksWidget

Source

pub fn new() -> Self

Create a new command blocks widget

Source

pub fn add_block(&mut self, block: CommandBlock)

Add a block

Source

pub fn select_next_block(&mut self)

Select next block

Source

pub fn select_prev_block(&mut self)

Select previous block

Source

pub fn get_selected_block(&self) -> Option<&CommandBlock>

Get the selected block

Source

pub fn get_selected_block_mut(&mut self) -> Option<&mut CommandBlock>

Get the selected block (mutable)

Source

pub fn toggle_selected_block_collapsed(&mut self)

Toggle selected block collapsed state

Source

pub fn clear(&mut self)

Clear all blocks

Source

pub fn total_commands(&self) -> usize

Get total number of commands across all blocks

Source

pub fn total_success(&self) -> usize

Get total number of successful commands

Source

pub fn total_failed(&self) -> usize

Get total number of failed commands

Source

pub fn total_running(&self) -> usize

Get total number of running commands

Source

pub fn copy_selected_block( &mut self, action_type: CopyActionType, ) -> Result<(), String>

Copy selected block content

Source

pub fn copy_all_blocks(&mut self) -> Result<(), String>

Copy all blocks content

Source

pub fn copy_block_by_index( &mut self, block_idx: usize, action_type: CopyActionType, ) -> Result<(), String>

Copy block by index

Source

pub fn get_last_copy_result(&self) -> Option<&Result<CopyActionType, String>>

Get the last copy result

Source

pub fn clear_copy_result(&mut self)

Clear the last copy result

Trait Implementations§

Source§

impl Default for CommandBlocksWidget

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more