pub struct ModeManager {
pub current_mode: OperatingMode,
pub mode_history: Vec<(OperatingMode, SystemTime)>,
pub restrictions: ModeRestrictions,
}Fields§
§current_mode: OperatingMode§mode_history: Vec<(OperatingMode, SystemTime)>§restrictions: ModeRestrictionsImplementations§
Source§impl ModeManager
impl ModeManager
pub fn new(initial: OperatingMode) -> Self
pub fn switch_mode(&mut self, new_mode: OperatingMode)
Sourcepub fn cycle(&mut self) -> OperatingMode
pub fn cycle(&mut self) -> OperatingMode
Cycle to the next mode (Plan → Build → Review → Plan)
Sourcepub const fn current_mode(&self) -> OperatingMode
pub const fn current_mode(&self) -> OperatingMode
Get the current mode
Sourcepub const fn current_visuals(&self) -> ModeVisuals
pub const fn current_visuals(&self) -> ModeVisuals
Get visual properties for the current mode
Create a new thread-safe ModeManager
Sourcepub const fn is_read_only(&self) -> bool
pub const fn is_read_only(&self) -> bool
Check if the current mode is read-only
Sourcepub const fn allows_write(&self) -> bool
pub const fn allows_write(&self) -> bool
Check if file writes are allowed in the current mode
Sourcepub const fn allows_execution(&self) -> bool
pub const fn allows_execution(&self) -> bool
Check if command execution is allowed in the current mode
Sourcepub const fn can_write_file(&self, file_size: Option<usize>) -> bool
pub const fn can_write_file(&self, file_size: Option<usize>) -> bool
Check if a file operation is allowed in the current mode
Sourcepub const fn can_execute_command(&self) -> bool
pub const fn can_execute_command(&self) -> bool
Check if command execution is allowed in the current mode
Sourcepub const fn can_perform_git_operations(&self) -> bool
pub const fn can_perform_git_operations(&self) -> bool
Check if git operations are allowed in the current mode
Sourcepub const fn can_access_network(&self) -> bool
pub const fn can_access_network(&self) -> bool
Check if network access is allowed in the current mode
Sourcepub fn restriction_message(&self, operation: &str) -> String
pub fn restriction_message(&self, operation: &str) -> String
Get a user-friendly error message for disallowed operations
Sourcepub fn validate_file_write(
&self,
path: &str,
size: Option<usize>,
) -> Result<(), String>
pub fn validate_file_write( &self, path: &str, size: Option<usize>, ) -> Result<(), String>
Validate an operation and return a Result with appropriate error message
Sourcepub fn validate_command_execution(&self, command: &str) -> Result<(), String>
pub fn validate_command_execution(&self, command: &str) -> Result<(), String>
Validate command execution and return a Result with appropriate error message
Sourcepub fn validate_git_operation(&self, operation: &str) -> Result<(), String>
pub fn validate_git_operation(&self, operation: &str) -> Result<(), String>
Validate git operations and return a Result with appropriate error message
pub const fn prompt_suffix(&self) -> &'static str
Trait Implementations§
Source§impl Clone for ModeManager
impl Clone for ModeManager
Source§fn clone(&self) -> ModeManager
fn clone(&self) -> ModeManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ModeManager
impl RefUnwindSafe for ModeManager
impl Send for ModeManager
impl Sync for ModeManager
impl Unpin for ModeManager
impl UnwindSafe for ModeManager
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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>
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>
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