Skip to main content

App

Struct App 

Source
pub struct App {
Show 44 fields pub vault: Vault, pub vault_manager: VaultManager, pub vault_selector: VaultSelector, pub screen: Screen, pub master_input: String, pub master_confirm_input: String, pub master_mode_is_setup: bool, pub unlock_focus: UnlockField, pub error: Option<String>, pub items: Vec<Item>, pub selected: usize, pub view_mode: ViewMode, pub filtered_items: Vec<Item>, pub search_query: String, pub search_mode: bool, pub add_name: String, pub add_kind_idx: usize, pub add_value: String, pub add_value_scroll: usize, pub status_message: Option<String>, pub status_type: StatusType, pub scroll_offset: usize, pub add_value_textarea: TextArea<'static>, pub auto_lock_service: Option<Arc<AutoLockService>>, pub auto_locked: bool, pub countdown_info: Option<CountdownInfo>, pub ck_current: String, pub ck_new: String, pub ck_confirm: String, pub ck_focus: ChangeKeyField, pub add_focus: AddItemField, pub view_item: Option<Item>, pub view_show_value: bool, pub edit_item: Option<Item>, pub edit_value: String, pub gen_focus: PasswordGenField, pub gen_length_str: String, pub gen_config: PasswordConfig, pub generated_password: Option<String>, pub ie_focus: ImportExportField, pub ie_mode: ImportExportMode, pub ie_path: String, pub ie_format_idx: usize, pub ie_formats: Vec<&'static str>,
}

Fields§

§vault: Vault§vault_manager: VaultManager§vault_selector: VaultSelector§screen: Screen§master_input: String§master_confirm_input: String§master_mode_is_setup: bool§unlock_focus: UnlockField§error: Option<String>§items: Vec<Item>§selected: usize§view_mode: ViewMode§filtered_items: Vec<Item>§search_query: String§search_mode: bool§add_name: String§add_kind_idx: usize§add_value: String§add_value_scroll: usize§status_message: Option<String>§status_type: StatusType§scroll_offset: usize§add_value_textarea: TextArea<'static>§auto_lock_service: Option<Arc<AutoLockService>>§auto_locked: bool§countdown_info: Option<CountdownInfo>§ck_current: String§ck_new: String§ck_confirm: String§ck_focus: ChangeKeyField§add_focus: AddItemField§view_item: Option<Item>§view_show_value: bool§edit_item: Option<Item>§edit_value: String§gen_focus: PasswordGenField§gen_length_str: String§gen_config: PasswordConfig§generated_password: Option<String>§ie_focus: ImportExportField§ie_mode: ImportExportMode§ie_path: String§ie_format_idx: usize§ie_formats: Vec<&'static str>

Implementations§

Source§

impl App

Source

pub fn new() -> Result<Self>

Initializes a new instance of the struct.

This function creates or opens a vault, determines whether the master mode setup is required, and initializes the various fields required for managing the application state.

§Returns
  • Result<Self>: A Result containing the initialized struct instance on success, or an error if the vault fails to open or create.
§Fields
  • vault: Handles secure storage by opening or creating a vault.
  • screen: Represents the current active screen, initialized to the Unlock screen.
  • master_input: Stores user input for the master password during setup or unlock phase.
  • master_confirm_input: Stores user input for confirming the master password during setup.
  • master_mode_is_setup: Indicates whether the master mode is set up (false if initialization is incomplete).
  • unlock_focus: Tracks which unlock field is currently focused (e.g., Master field).
  • error: Holds any error message or state, defaulted to None.
  • items: A vector holding all items stored in the vault.
  • selected: Tracks the index of the currently selected item in the items list.
  • view_mode: Specifies the current filter/view mode for items (e.g., All items).
  • filtered_items: A vector holding the subset of items that match the current search query or filter.
  • search_query: Stores the user’s current search input or query.
  • add_name: Field for the name of an item to be added.
  • add_kind_idx: Indicates the index of the kind/type of the item being added.
  • add_value: The value of the item being added.
  • add_value_scroll: Tracks the scroll state for long values when adding an item.
  • status_message: Holds transient status messages to display to the user.
  • status_type: Indicates the type of status message (e.g., Info, Warning, Error).
§Change Key Fields
  • ck_current: Stores the current master key value.
  • ck_new: Stores the new master key value.
  • ck_confirm: Confirms the new master key value.
  • ck_focus: Tracks which field is focused during the change key process.
§Add Item Fields
  • add_focus: Tracks which field is focused when adding a new item (e.g., Name).
§Viewing and Editing Items
  • view_item: The currently selected item for viewing, if any.
  • view_show_value: Indicates whether to reveal the value of the viewed item.
  • edit_item: The item currently being edited, if any.
  • edit_value: The edited value of the currently selected item.
§Password Generation
  • gen_focus: The current focus field in the password generation process (e.g., Length).
  • gen_length_str: String representation of the desired password length (default: “16”).
  • gen_config: Configuration settings for password generation (e.g., character set, length).
  • generated_password: Holds the last generated password, if any.
§Import/Export
  • ie_focus: Tracks which field is focused during import/export operations (e.g., File Path).
  • ie_mode: Indicates the mode (Import or Export) for import/export operations.
  • ie_path: Stores the file path selected for import/export.
  • ie_format_idx: Tracks the index of the currently selected format for import/export.
  • ie_formats: A vector containing supported file formats for import/export (e.g., “json”, “csv”).
§Errors

Return an error if the vault cannot be opened or created successfully.

§Panics
Source

pub fn unlock(&mut self) -> Result<()>

Unlocks the application vault using the provided master key and performs necessary validations.

This function checks if the master key setup process is initiated, validates the user input, and sets up or unlocks the vault accordingly. In case of errors during validation or unlocking operations, appropriate error messages are set.

§Steps
  1. If master_mode_is_setup is true:
    • Validate the presence of master input and confirmation input. If either is empty, an error message is set, and the function will return early.
    • Compare master_input and master_confirm_input. If they do not match, an error message is set, and the function exits.
    • Validate the strength of the master_input using validate_master_strength. If it fails, sets an error message and exits.
    • Initialize the vault with master_input and reset the master_mode_is_setup flag to false.
  2. Unlock the vault with the provided master_input. On failure to unlock, sets an error message with the reason and exits with the corresponding error.
  3. Refresh the items in the application to reflect the unlocked state.
  4. Set the current screen to Screen::Main.
  5. Clear any existing error messages to indicate successful operation.
  6. Return Ok(()) if no errors occurred.
§Returns
  • Ok(()) on successful unlocking and initialization of the vault.
  • Err with the propagation of error from validation or unlocking operations.
§Errors

This function sets the error field with one of the following messages on failure:

  • “Please enter and confirm your master key.” - if either master input or confirmation input is missing.
  • “Master keys do not match.” - if the confirmation of the master key does not match the input.
  • Error message returned by validate_master_strength - if the master key is deemed weak or invalid.
  • “Unlock failed: {e}” - if unlocking the vault fails.
§Side Effects
  • Updates the error field in the struct to reflect any issues encountered during execution.
  • Modifies the state of screen, master_mode_is_setup, and vault upon successful execution.
Source

pub fn refresh_items(&mut self) -> Result<()>

Refreshes the list of items and updates the filtered items.

This method performs the following actions:

  1. Updates the items field by retrieving the latest list of items from the vault.
  2. Applies filtering logic to update the filtered_items list.
  3. Ensures that the current selection (selected) is within the bounds of the updated filtered_items list. If the current selection is out of bounds but the filtered_items list is not empty, it adjusts selected to the last valid index.
§Errors

Returns an error if fetching the list of items from the vault fails.

§Returns
  • Ok(()) if the operation is successful.
  • Err with the specific error encountered when listing items from the vault.
Source

pub fn update_filtered_items(&mut self)

Source

pub fn get_selected_item(&self) -> Option<&Item>

Source

pub fn get_item_counts(&self) -> ItemCounts

Source

pub fn add_item(&mut self) -> Result<()>

Adds a new item to the vault with the specified details and updates the UI.

§Description

This function creates a new item based on the user input, validates it, and stores it in the vault. If the operation is successful, the UI is updated to reflect the addition and the input fields are reset. If an error occurs, appropriate error messages and statuses are set.

§Fields Used
  • add_kind_idx: Determines the type of item being added (e.g., Password, EnvVar, Note, etc.).
  • add_name: The name of the new item, trimmed of whitespace.
  • add_value_textarea: The content or value of the new item, usually multi-line.
  • vault: The storage structure which handles item creation.
  • add_value: Secondary field for item value, cleared after addition.
  • add_value_scroll: Resets the scroll position of the textarea after addition.
  • screen: Sets the screen to the main view upon successful addition.
  • error: Displays error messages for failed operations.
  • status: Updates the user-visible status of the addition operation.
§Process
  1. Determines the item type (kind) based on add_kind_idx:
    • 0 -> Password
    • 1 -> Environment Variable
    • 3 -> API Key
    • 4 -> SSH Key
    • 5 -> Certificate
    • 6 -> Database
    • Default -> Note
  2. Fetches the item’s value from the textarea (add_value_textarea), joining multiple lines with \n.
  3. Creates a NewItem structure with the gathered data.
  4. Attempts to add the item using vault.create_item.
  5. Handles responses:
    • Success: Resets input fields, updates item list, switches to the main screen, and displays a success message.
    • Failure: If the name already exists, prompts the user to choose a different name. For other errors, displays a generic error message.
§Returns

Returns an Ok(()) on successful completion of the process or propagates an error if any step fails.

§Errors
  • Returns an error if refreshing the items (refresh_items) fails.
  • Updates the error and status fields with detailed context if item creation fails.
§Notes
  • Resets both single-line (add_value) and multi-line (add_value_textarea) value fields upon successful addition.
  • Automatically trims leading and trailing whitespace from the item name.
Source

pub fn delete_selected(&mut self) -> Result<()>

Deletes the currently selected item from the vault.

This function retrieves the currently selected item, deletes it from the vault using its unique identifier, and then refreshes the list of items to reflect the changes. If no item is selected, the function does nothing.

§Errors

Returns an error if:

  • Retrieving the selected item fails.
  • Deleting the item from the vault fails.
  • Refreshing the item list fails.
Source

pub fn change_master(&mut self) -> Result<()>

Changes the master key for the application if provided inputs meet the necessary conditions.

This function performs several validations to ensure the master key change process is secure:

  1. It checks if all required input fields (ck_current, ck_new, and ck_confirm) are filled.
  2. It validates that the new master key (ck_new) matches the confirmation key (ck_confirm).
  3. It verifies the strength of the new master key using the validate_master_strength method.

If any of these conditions fail, an appropriate error message is stored in the error field, and the process halts without changing the master key.

Once all validations are passed, the function updates the master key by calling the change_master_key method of the vault. After a successful update, it clears all input fields, resets the error message, and navigates back to the main screen.

§Returns
  • Ok(()) - If the master key has been successfully changed or the process ended due to a validation failure without panicking.
  • Err(Error) - If an error occurs while attempting to change the key in the vault.
§Errors
  • If any of the following conditions occur, an error is stored in the error field, and the function returns Ok:
    • Any of the required fields (ck_current, ck_new, or ck_confirm) are empty.
    • The new master key and confirmation key do not match.
    • The new master key fails the strength validation.
  • If the vault.change_master_key method returns an error, it will propagate as a Result::Err.
Source

pub fn copy_selected(&mut self) -> Result<()>

Copies the currently selected item to the clipboard.

This function retrieves the currently selected item using the get_selected_item method. If an item is selected, it initializes the system clipboard, attempts to copy the selected item’s value to the clipboard, and updates the status message to indicate success.

§Returns
  • Ok(()) - If the item is successfully copied to the clipboard or no item is selected.
  • Err(anyhow::Error) - If there’s an error while accessing the clipboard or copying the item to the clipboard.
§Errors
  • Returns an error if accessing the clipboard fails.
  • Returns an error if copying the selected item’s value to the clipboard fails.
§Behavior
  • If no item is selected (get_selected_item returns None), the function does nothing and returns Ok(()).

  • If an item is selected (get_selected_item returns Some), it:

    • Initializes a new arboard::Clipboard instance.
    • Copies the value of the selected item to the clipboard.
    • Sets a status message indicating that the item has been successfully copied to the clipboard.
§Dependencies

This function relies on the arboard crate for clipboard interactions and the anyhow crate for error handling. It also assumes the existence of the following methods:

  • get_selected_item: Retrieves the currently selected item, returning an option.
  • set_status: Updates the application’s status message and type.
Source

pub fn view_selected(&mut self)

Source

pub const fn toggle_value_visibility(&mut self)

Source

pub fn edit_selected(&mut self)

Source

pub fn save_edit(&mut self) -> Result<()>

Attempts to save edits made to an item in the vault and updates the user interface accordingly.

§Behavior
  • If the edit_value is empty (after trimming), it sets an error message (“Value cannot be empty”) and exits early.
  • Otherwise, it updates the item in the vault identified by edit_item.id with the new edit_value.
  • After updating the item, it clears the edit_item and edit_value, refreshes the list of items, and switches the application’s screen back to the main screen while clearing any previous errors.
§Errors
  • If updating the vault fails, an error is propagated from the vault.update_item method.
  • If refreshing items fails, an error is propagated from the refresh_items method.
§Returns
  • Ok(()) if the edit is successfully saved or if the edit_value is empty.
  • Err if an error occurs during vault updates or refreshing items.
§Fields/State
  • self.edit_item: The item currently being edited. If None, the method does nothing.
  • self.edit_value: The new value to be saved to the item. If empty (once trimmed), the method sets an error message and exits early.
  • self.error: An optional error message for display purposes. This is set if the edit_value is empty or cleared on successful operation.
  • self.vault: The storage mechanism used to update the item.
  • self.screen: Controls the application screen flow. Set to Screen::Main after a successful edit.
Source

pub fn open_password_generator(&mut self)

Source

pub fn generate_password(&mut self)

Source

pub fn copy_generated_password(&mut self) -> Result<()>

Copies the generated password to the system clipboard.

This function attempts to access the generated password stored in the self.generated_password field and copies it to the system clipboard using the arboard crate. If the operation succeeds, a success message is set in the self.error field. In the event of an error while accessing the clipboard or copying the text, the function returns a corresponding error.

§Returns
  • Ok(()) - If the password is successfully copied to the clipboard or no password was generated.
  • Err(anyhow::Error) - If accessing the clipboard or copying the password fails.
§Errors

This function may return an error in the following scenarios:

  • Failure to access or initialize the system clipboard.
  • Failure to copy the generated password to the clipboard.
§Side Effects
  • If a password is successfully copied to the clipboard, the self.error field is set with a success message.
§Dependencies

This function makes use of the arboard crate for clipboard access and text manipulation.

Source

pub fn use_generated_password(&mut self)

Source

pub fn open_import_export(&mut self, mode: ImportExportMode)

Source

pub fn execute_import_export(&mut self) -> Result<()>

Executes the import or export operation based on the current application state.

This method performs the following operations:

  1. Validates the provided file path and ensures it is not empty.
  2. Normalizes the file path to handle different path separators and expand the home directory.
  3. Determines the format of import/export (CSV, JSON, or backup).
  4. Executes the import or export operation based on the selected mode (ImportExportMode).
§Export Mode
  • Creates necessary parent directories if they do not exist.
  • Exports the current items to the specified file path in the selected format.
  • Sets an appropriate success message indicating the number of items exported and the file path.
§Import Mode
  • Ensures the specified file exists before proceeding.
  • Imports items from the file in the specified format.
  • Avoids importing duplicate items by checking against existing item names.
  • Records the number of imported and skipped items due to duplication or errors.
  • Updates the item list after a successful import and presents an appropriate summary message.
§Errors
  • If the file path is empty, a user-friendly error message is set and the operation is aborted.
  • If a directory creation fails during export, an error is returned.
  • If certain items cannot be imported due to conflicts or other errors, they are counted as skipped.
§Remarks
  • Upon completion (successful or not), the application state is updated to the main screen.
§Returns
  • Ok(()) if the operation completes successfully (even if some items were skipped).
  • Err if a file path normalization or file operation fails during the execution.
§Preconditions
  • self.ie_path must be set to a valid file path.
  • The self.ie_formats array must include supported formats (“csv”, “backup”, “json”).
  • The self.items list is expected to contain the current application items for export/import validation.
§Postconditions
  • Updates self.error with a descriptive message about the operation result.
  • Changes the application state screen to Screen::Main.
Source

pub fn set_status(&mut self, message: String, status_type: StatusType)

Source

pub fn clear_status(&mut self)

Source

pub fn is_in_input_mode(&self) -> bool

Source

pub fn paste_to_add_value(&mut self) -> Result<()>

Pastes content from the clipboard to the add item value field.

This function retrieves text content from the system clipboard and appends it to the current add_value field. If the clipboard contains text, it will be added to the existing value. If accessing the clipboard fails, an appropriate status message is displayed.

§Returns
  • Ok(()) - If the paste operation completes successfully or if there’s no text in clipboard.
  • Err(anyhow::Error) - If accessing the clipboard fails.
§Errors
  • Returns an error if accessing the clipboard fails.
  • Sets a warning status if the clipboard is empty or contains no text.
§Behavior
  • Retrieves text from the system clipboard using arboard::Clipboard.
  • Appends the clipboard content to the current add_value field.
  • Sets a success status message indicating the paste operation completed.
  • If clipboard is empty or contains no text, shows a warning message.
Source

pub fn open_vault_selector(&mut self)

Source

pub fn handle_vault_action(&mut self, action: VaultAction) -> Result<()>

Handles various actions related to vault management.

This function processes the provided VaultAction and executes the corresponding logic to manage vaults, such as creating, updating, deleting, importing, and more.

§Arguments
  • action - A VaultAction enum that specifies the action to be performed. Each variant of VaultAction corresponds to a specific vault-related operation.
§Returns
  • Result<()> - Returns Ok(()) if the action was processed successfully; otherwise, an error is returned if any operation fails.
§VaultAction Variants
  • VaultAction::Switch(vault_id) Switches to the specified vault by its ID.

  • VaultAction::Create { name, description, category } Creates a new vault with the provided name, description, and category.

  • VaultAction::Update { vault_id, name, description, category, favorite } Updates an existing vault with the given parameters, including optional fields like the vault name, description, category, and favorite status.

  • VaultAction::Delete { vault_id, delete_file } Deletes a vault specified by its ID. If delete_file is true, related files are also deleted.

  • VaultAction::Import { path } Imports a vault from a specified file path.

  • VaultAction::Refresh Reloads the list of available vaults and updates the UI to reflect any changes. Sets a success status message indicating the vaults have been refreshed.

  • VaultAction::Close Hides the vault selector and switches back to the main screen.

  • VaultAction::ShowHelp Displays help information. (This action may be handled or ignored based on needs.)

§Errors

Returns an error if:

  • Switching to a vault fails.
  • The requested vault action encounters an issue (e.g., file access issues during imports or failures in vault creation/deletion).
Source

pub async fn update_activity(&mut self)

Source

pub async fn check_auto_lock(&mut self) -> bool

Source

pub async fn get_time_until_auto_lock(&self) -> Option<Duration>

Source

pub async fn update_countdown_info(&mut self)

Source

pub const fn get_countdown_info(&self) -> Option<&CountdownInfo>

Auto Trait Implementations§

§

impl !Freeze for App

§

impl !RefUnwindSafe for App

§

impl Send for App

§

impl !Sync for App

§

impl Unpin for App

§

impl UnsafeUnpin for App

§

impl !UnwindSafe for App

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<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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