### Example of `trim_start_matches` Source: https://docs.rs/oopsie/latest/oopsie/struct.HelpText.html Demonstrates removing multiple occurrences of characters from the start of a string. ```rust let x: &[_] = &['1', '2']; assert_eq!("12foo1bar12".trim_start_matches(x), "foo1bar12"); ``` -------------------------------- ### Slice len Method Example Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.EnvArgs.html Demonstrates how to get the number of elements in a slice. ```rust let a = [1, 2, 3]; assert_eq!(a.len(), 3); ``` -------------------------------- ### Basic Error Build Example Source: https://docs.rs/oopsie/latest/oopsie/attr.oopsie.html A simple example demonstrating how to build an error using the `app_oopsies::Boom` type and assert its string representation. ```rust fn main() { let err = app_oopsies::Boom.build(); assert_eq!(err.to_string(), "boom"); } ``` -------------------------------- ### Slice first Method Example Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.EnvArgs.html Demonstrates how to get the first element of a slice, returning None if the slice is empty. ```rust let v = [10, 40, 30]; assert_eq!(Some(&10), v.first()); let w: &[i32] = &[]; assert_eq!(None, w.first()); ``` -------------------------------- ### Start Marker Macro Source: https://docs.rs/oopsie/latest/oopsie/all.html The `start_marker` macro for marking the start of an operation. ```APIDOC ### Macros ### `start_marker` #### Description Macro to mark the start of an operation. ``` -------------------------------- ### Install Panic Hook Source: https://docs.rs/oopsie/latest/oopsie/fn.install_panic_hook.html Installs a global panic hook that renders panics with a colored message, span trace, and backtrace. Call this once early in main before spawning threads. ```rust pub fn install_panic_hook() ``` -------------------------------- ### Install Custom Panic Hook Source: https://docs.rs/oopsie/latest/src/oopsie/panic_hook.rs.html Installs a global panic hook that renders panics using TracePrinter. Call this early in main. Backtrace capture depends on RUST_BACKTRACE. ```rust pub fn install_panic_hook() { std::panic::set_hook(Box::new(|info| { eprint!("{}", PanicReport::new(info)); })); } ``` -------------------------------- ### Get Help Style Source: https://docs.rs/oopsie/latest/oopsie/struct.Theme.html Returns the Style for the 'help' label. This method is part of the Theme implementation. ```rust pub const fn help(&self) -> Style ``` -------------------------------- ### starts_with() Source: https://docs.rs/oopsie/latest/oopsie/struct.HelpText.html Checks if the string slice starts with a given pattern. ```APIDOC ## pub fn starts_with

(&self, pat: P) -> bool where P: Pattern, ### Description Returns `true` if the given pattern matches a prefix of this string slice. Returns `false` if it does not. The pattern can be a `&str`, in which case this function will return true if the `&str` is a prefix of this string slice. The pattern can also be a `char`, a slice of `char`s, or a function or closure that determines if a character matches. These will only be checked against the first character of this string slice. ### Examples ```rust let bananas = "bananas"; assert!(bananas.starts_with("bana")); assert!(!bananas.starts_with("nana")); ``` ```rust let bananas = "bananas"; // Note that both of these assert successfully. assert!(bananas.starts_with(&['b', 'a', 'n', 'a'])); assert!(bananas.starts_with(&['a', 'b', 'c', 'd'])); ``` ``` -------------------------------- ### install_panic_hook Source: https://docs.rs/oopsie/latest/oopsie/fn.install_panic_hook.html Installs a process-global panic hook that renders panics with a colored message, span trace, and backtrace via `TracePrinter`. This function replaces any previously installed hook and should be called once early in `main`, before spawning threads. Backtrace capture is controlled by `RUST_BACKTRACE`. ```APIDOC ## Function install_panic_hook ### Description Install a process-global panic hook that renders panics with a colored message, span trace, and backtrace via `TracePrinter`. Replaces any previously installed hook through `std::panic::set_hook`, so call it once early in `main`, before spawning threads. Backtrace capture follows std’s panic semantics: `RUST_BACKTRACE` only. `RUST_LIB_BACKTRACE` intentionally has no effect on panic output. With capture disabled, only the message and location are shown plus a hint to enable it. ### Signature ```rust pub fn install_panic_hook() ``` ``` -------------------------------- ### Chaining and Root Cause Example Source: https://docs.rs/oopsie/latest/oopsie/prelude/trait.ErrorChainExt.html Demonstrates how to use `chain` to collect all error messages in a source chain and `root_cause` to get the ultimate underlying error. This is useful for logging or debugging complex error scenarios. ```rust use oopsie::{Oopsie, ErrorChainExt as _, ResultExt as _}; #[derive(Debug, Oopsie)] #[oopsie(module(false))] enum ReadError { #[oopsie("read failed: {source}")] Read { source: std::io::Error }, } let err: Result<(), std::io::Error> = Err(std::io::Error::other("disk full")); let err = err.context(Read).unwrap_err(); let messages: Vec = err.chain().map(ToString::to_string).collect(); assert_eq!(messages, ["read failed: disk full", "disk full"]); assert_eq!(err.root_cause().to_string(), "disk full"); ``` -------------------------------- ### Example of ResultExt Usage Source: https://docs.rs/oopsie/latest/oopsie/prelude/trait.ResultExt.html Demonstrates how to use the `context` method to wrap an error with custom context. Ensure `Oopsie` and `ResultExt` are imported. ```rust use oopsie::{Oopsie, ResultExt as _}; #[derive(Debug, Oopsie)] #[oopsie(module(false))] enum IoError { #[oopsie("IO failed: {source}")] Failed { source: std::io::Error }, } let result: Result<(), std::io::Error> = Err(std::io::Error::other("disk full")); let err = result.context(Failed).unwrap_err(); assert_eq!(err.to_string(), "IO failed: disk full"); ``` -------------------------------- ### Basic Error Build Example Source: https://docs.rs/oopsie/latest/oopsie/attr.oopsie.html Demonstrates building a simple error using the `Boom` variant and asserting its debug representation. ```rust fn main() { let err = app_oopsies::Boom.build(); assert_eq!(format!("{err:?}"), "custom debug"); } ``` -------------------------------- ### Slice split_first Method Example Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.EnvArgs.html Demonstrates how to split a slice into its first element and the rest of the slice, returning None if the slice is empty. ```rust let x = &[0, 1, 2]; if let Some((first, elements)) = x.split_first() { assert_eq!(first, &0); assert_eq!(elements, &[1, 2]); } ``` -------------------------------- ### Slice is_empty Method Example Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.EnvArgs.html Demonstrates how to check if a slice is empty. ```rust let a = [1, 2, 3]; assert!(!a.is_empty()); let b: &[i32] = &[]; assert!(b.is_empty()); ``` -------------------------------- ### starts_with() Source: https://docs.rs/oopsie/latest/oopsie/struct.ErrorCode.html Checks if the string slice starts with a given pattern. The pattern can be a `&str`, `char`, a slice of `char`s, or a closure. ```APIDOC ## starts_with() ### Description Returns `true` if the given pattern matches a prefix of this string slice, and `false` otherwise. The pattern can be a `&str`, `char`, a slice of `char`s, or a function or closure that determines if a character matches. ### Method `starts_with

(&self, pat: P) -> bool` where `P: Pattern` ### Parameters * **pat** (P) - The pattern to check against the prefix. ### Response `bool` - `true` if the string starts with the pattern, `false` otherwise. ### Request Example ```rust let bananas = "bananas"; assert!(bananas.starts_with("bana")); assert!(!bananas.starts_with("nana")); ``` ### Response Example `true` or `false` ``` -------------------------------- ### Using Welp with welp_context Source: https://docs.rs/oopsie/latest/oopsie/prelude/struct.Welp.html Example demonstrating how to use the `welp_context` method to add context to a Result, returning a `Welp` error. ```APIDOC ## Example Usage ```rust use oopsie_core::{Welp, WelpResultExt as _}; fn read_config(path: &str) -> Result { std::fs::read_to_string(path).welp_context("could not read config") } ``` ``` -------------------------------- ### Get Process-Global Theme Source: https://docs.rs/oopsie/latest/src/oopsie/theme.rs.html Retrieves the current process-global theme. This is used by `Report` and the panic hook. ```rust /// The current process-global theme. #[must_use] #[inline] pub fn get_theme() -> Theme { THEME.read().unwrap_or_else(PoisonError::into_inner).clone() } ``` -------------------------------- ### Slice get Method Example Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.EnvArgs.html Demonstrates how to get an element or subslice from a slice by index or range. Returns None if the index or range is out of bounds. ```rust let v = [10, 40, 30]; assert_eq!(Some(&40), v.get(1)); assert_eq!(Some(&[10, 40][..]), v.get(0..2)); assert_eq!(None, v.get(3)); assert_eq!(None, v.get(0..4)); ``` -------------------------------- ### Slice last Method Example Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.EnvArgs.html Demonstrates how to get the last element of a slice, returning None if the slice is empty. ```rust let v = [10, 40, 30]; assert_eq!(Some(&30), v.last()); let w: &[i32] = &[]; assert_eq!(None, w.last()); ``` -------------------------------- ### Strip Prefix: `strip_prefix` Source: https://docs.rs/oopsie/latest/oopsie/struct.HelpText.html Removes a prefix exactly once if the string starts with it, returning an Option<&str>. Useful when you need to confirm the prefix exists and get the remainder. ```rust assert_eq!("foo:bar".strip_prefix("foo:"), Some("bar")); assert_eq!("foo:bar".strip_prefix("bar"), None); assert_eq!("foofoo".strip_prefix("foo"), Some("foo")); ``` -------------------------------- ### Define Style for Help Label Source: https://docs.rs/oopsie/latest/src/oopsie/theme.rs.html Returns a `Style` object for the `help` label. This is part of the `Theme` struct. ```rust #[must_use] pub const fn help(&self) -> Style { Style::from_rgb(self.teal) } ``` -------------------------------- ### Building an Error from Scratch (Leaf Variant) Source: https://docs.rs/oopsie/latest/oopsie/index.html Selectors for leaf variants (no source) expose `.build()` and `.fail()`, and work with `Option::context`. ```rust .build() ``` -------------------------------- ### Slice last_chunk Method Example Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.EnvArgs.html Demonstrates how to get an array reference to the last N items in a slice. Returns None if the slice is not at least N in length. ```rust let u = [10, 40, 30]; assert_eq!(Some(&[40, 30]), u.last_chunk::<2>()); let v: &[i32] = &[10]; assert_eq!(None, v.last_chunk::<2>()); let w: &[i32] = &[]; assert_eq!(Some(&[]), w.last_chunk::<0>()); ``` -------------------------------- ### Building an Error from Scratch (Leaf Variant) Source: https://docs.rs/oopsie/latest/oopsie/index.html Selectors for leaf variants (no source) expose `.build()` and `.fail()`, and work with `Option::context`. ```rust .fail() ``` -------------------------------- ### Slice first_chunk Method Example Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.EnvArgs.html Demonstrates how to get an array reference to the first N items in a slice. Returns None if the slice is not at least N in length. ```rust let u = [10, 40, 30]; assert_eq!(Some(&[10, 40]), u.first_chunk::<2>()); let v: &[i32] = &[10]; assert_eq!(None, v.first_chunk::<2>()); let w: &[i32] = &[]; assert_eq!(Some(&[]), w.first_chunk::<0>()); ``` -------------------------------- ### Get Raw Pointer to Slice Buffer Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.EnvArgs.html Obtains a raw pointer to the start of the slice's data. Ensure the slice outlives the pointer and that the memory is not mutated through this pointer. ```rust let x = &[1, 2, 4]; let x_ptr = x.as_ptr(); unsafe { for i in 0..x.len() { assert_eq!(x.get_unchecked(i), &*x_ptr.add(i)); } } ``` -------------------------------- ### Theme Setting and Getting Source: https://docs.rs/oopsie/latest/src/oopsie/theme.rs.html Provides functions to set a new global theme and retrieve the current one. These functions affect all reports and panic messages unless overridden. ```APIDOC ## set_theme ### Description Replace the process-global theme used by `Report` and the panic hook. Affects every report that doesn't carry a per-instance override. ### Function Signature ```rust pub fn set_theme(theme: Theme) ``` ## get_theme ### Description Returns the current process-global theme. ### Function Signature ```rust #[must_use] pub fn get_theme() -> Theme ``` ### Example ```rust // Get the current theme let current_theme = get_theme(); // Set a new theme (assuming Theme::DRACULA exists) set_theme(Theme::DRACULA); // Get the updated theme let updated_theme = get_theme(); ``` ``` -------------------------------- ### Get Raw Pointer Range Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.EnvArgs.html Returns a range of two raw pointers representing the start and one-past-the-end of the slice's buffer. Useful for C interop and checking pointer containment. ```rust let a = [1, 2, 3]; let x = &a[1] as *const _; let y = &5 as *const _; assert!(a.as_ptr_range().contains(&x)); assert!(!a.as_ptr_range().contains(&y)); ``` -------------------------------- ### Iterate Over Subslices Separated by Elements (Reverse) Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.EnvArgs.html Use `rsplit` to get an iterator over subslices separated by elements matching a predicate, starting from the end. The matched element is not included. An empty slice is returned if the first or last element matches the predicate. ```rust let slice = [11, 22, 33, 0, 44, 55]; let mut iter = slice.rsplit(|num| *num == 0); assert_eq!(iter.next().unwrap(), &[44, 55]); assert_eq!(iter.next().unwrap(), &[11, 22, 33]); assert_eq!(iter.next(), None); ``` ```rust let v = &[0, 1, 1, 2, 3, 5, 8]; let mut it = v.rsplit(|n| *n % 2 == 0); assert_eq!(it.next().unwrap(), &[]); assert_eq!(it.next().unwrap(), &[3, 5]); assert_eq!(it.next().unwrap(), &[1, 1]); assert_eq!(it.next().unwrap(), &[]); assert_eq!(it.next(), None); ``` -------------------------------- ### Get element index using pointer arithmetic Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.EnvArgs.html Use `element_offset` to find the index of a given element reference within a slice. This method relies on pointer arithmetic and does not compare element values. It returns `None` if the reference is not aligned to the start of an element. ```rust let nums: &[u32] = &[1, 7, 1, 1]; let num = &nums[2]; assert_eq!(num, &1); assert_eq!(nums.element_offset(num), Some(2)); ``` ```rust let arr: &[[u32; 2]] = &[[0, 1], [2, 3]]; let flat_arr: &[u32] = arr.as_flattened(); let ok_elm: &[u32; 2] = flat_arr[0..2].try_into().unwrap(); let weird_elm: &[u32; 2] = flat_arr[1..3].try_into().unwrap(); assert_eq!(ok_elm, &[0, 1]); assert_eq!(weird_elm, &[1, 2]); assert_eq!(arr.element_offset(ok_elm), Some(0)); // Points to element 0 assert_eq!(arr.element_offset(weird_elm), None); // Points between element 0 and 1 ``` -------------------------------- ### HelpText Constructors Source: https://docs.rs/oopsie/latest/oopsie/struct.HelpText.html Methods to create new instances of HelpText. ```APIDOC ## `HelpText::from_static` Build a new `HelpText` from a `&'static str`. ### Signature ```rust pub const fn from_static(s: &'static str) -> HelpText ``` ## `HelpText::from_string` Build a new `HelpText` from a `String`. ### Signature ```rust pub const fn from_string(s: String) -> HelpText ``` ``` -------------------------------- ### PartialEq for HelpText Source: https://docs.rs/oopsie/latest/oopsie/struct.HelpText.html Enables equality comparisons for HelpText instances. ```APIDOC ## fn eq(&self, other: &HelpText) -> bool ### Description Tests for `self` and `other` values to be equal, and is used by `==`. ### Method `eq` ### Parameters - `self`: A reference to the first HelpText instance. - `other`: A reference to the second HelpText instance. ### Returns - `bool`: True if the instances are equal, false otherwise. ``` ```APIDOC ## fn ne(&self, other: &Rhs) -> bool ### Description Tests for `!=`. ### Method `ne` ### Parameters - `self`: A reference to the first HelpText instance. - `other`: A reference to the second HelpText instance. ### Returns - `bool`: True if the instances are not equal, false otherwise. ``` -------------------------------- ### on_color Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.CurrentDirOpt.html 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`. ```APIDOC ## fn on_color(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self> ### Description 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`. ### Method Not applicable (method call) ### Endpoint Not applicable (method call) ### Parameters - **color** (Color) - Description: The color to set. ### Request Example Not applicable (method call) ### Response Not applicable (method call) ``` -------------------------------- ### Get Reference to Inner Value Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.CurrentDirOpt.html Use `as_ref` to get an Option<&T> from an Option without consuming the original. This is useful for inspecting the inner value without taking ownership. ```rust let text: Option = Some("Hello, world!".to_string()); // First, cast `Option` to `Option<&String>` with `as_ref`, // then consume *that* with `map`, leaving `text` on the stack. let text_length: Option = text.as_ref().map(|s| s.len()); println!("still can print text: {text:?}"); ``` -------------------------------- ### try_from Source: https://docs.rs/oopsie/latest/oopsie/extras/env_vars/struct.HomeVarName.html Performs the conversion. ```APIDOC ## try_from ### Description Performs the conversion. ### Method This is a function call, likely associated with a type, not an HTTP endpoint. ### Parameters * **value** (U) - The value to convert from. ### Request Example ```rust // Assuming `T` and `U` are types that support this conversion // let result: Result = T::try_from(some_u_value); ``` ### Response Returns a `Result`. ### Response Example ```rust // Ok(T) on success, Err(T::Error) on failure. ``` ``` -------------------------------- ### Bright Color Methods Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.EnvArgs.html Methods to set bright foreground and background colors. ```APIDOC ## Bright Color Methods ### Description Methods to set bright foreground and background colors. ### Methods - `on_bright_black()`: Change the background color to bright black. - `bright_red()`: Change the foreground color to bright red. - `on_bright_red()`: Change the background color to bright red. - `bright_green()`: Change the foreground color to bright green. - `on_bright_green()`: Change the background color to bright green. - `bright_yellow()`: Change the foreground color to bright yellow. - `on_bright_yellow()`: Change the background color to bright yellow. - `bright_blue()`: Change the foreground color to bright blue. - `on_bright_blue()`: Change the background color to bright blue. - `bright_magenta()`: Change the foreground color to bright magenta. - `on_bright_magenta()`: Change the background color to bright magenta. - `bright_purple()`: Change the foreground color to bright purple. - `on_bright_purple()`: Change the background color to bright purple. - `bright_cyan()`: Change the foreground color to bright cyan. - `on_bright_cyan()`: Change the background color to bright cyan. - `bright_white()`: Change the foreground color to bright white. - `on_bright_white()`: Change the background color to bright white. ``` -------------------------------- ### Get Current Panic Backtrace Setting Source: https://docs.rs/oopsie/latest/oopsie/backtrace/fn.current_panic.html Call `current_panic()` to get the effective panic backtrace setting for the current thread. This respects thread-local overrides and the `RUST_BACKTRACE` environment variable. ```Rust pub fn current_panic() -> RustBacktrace ``` -------------------------------- ### OwoColorize Implementations Source: https://docs.rs/oopsie/latest/oopsie/extras/env_vars/struct.RustLogVarName.html Provides methods for colorizing text output in the terminal, including foreground and background color settings for various colors. ```APIDOC ## OwoColorize Methods ### `fg(&self) -> FgColorDisplay<'_, C, Self>` Sets the foreground color generically. ### `bg(&self) -> BgColorDisplay<'_, C, Self>` Sets the background color generically. ### `black(&self) -> FgColorDisplay<'_, Black, Self>` Changes the foreground color to black. ### `on_black(&self) -> BgColorDisplay<'_, Black, Self>` Changes the background color to black. ### `red(&self) -> FgColorDisplay<'_, Red, Self>` Changes the foreground color to red. ### `on_red(&self) -> BgColorDisplay<'_, Red, Self>` Changes the background color to red. ### `green(&self) -> FgColorDisplay<'_, Green, Self>` Changes the foreground color to green. ### `on_green(&self) -> BgColorDisplay<'_, Green, Self>` Changes the background color to green. ### `yellow(&self) -> FgColorDisplay<'_, Yellow, Self>` Changes the foreground color to yellow. ### `on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>` Changes the background color to yellow. ### `blue(&self) -> FgColorDisplay<'_, Blue, Self>` Changes the foreground color to blue. ### `on_blue(&self) -> BgColorDisplay<'_, Blue, Self>` Changes the background color to blue. ### `magenta(&self) -> FgColorDisplay<'_, Magenta, Self>` Changes the foreground color to magenta. ### `on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>` Changes the background color to magenta. ### `purple(&self) -> FgColorDisplay<'_, Magenta, Self>` Changes the foreground color to purple. ### `on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>` Changes the background color to purple. ### `cyan(&self) -> FgColorDisplay<'_, Cyan, Self>` Changes the foreground color to cyan. ### `on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>` Changes the background color to cyan. ### `white(&self) -> FgColorDisplay<'_, White, Self>` Changes the foreground color to white. ### `on_white(&self) -> BgColorDisplay<'_, White, Self>` Changes the background color to white. ### `default_color(&self) -> FgColorDisplay<'_, Default, Self>` Changes the foreground color to the terminal default. ### `on_default_color(&self) -> BgColorDisplay<'_, Default, Self>` Changes the background color to the terminal default. ### `bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>` Changes the foreground color to bright black. ### `on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>` Changes the background color to bright black. ### `bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>` Changes the foreground color to bright red. ### `on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>` Changes the background color to bright red. ### `bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>` Changes the foreground color to bright green. ### `on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>` Changes the background color to bright green. ### `bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>` Changes the foreground color to bright yellow. ### `on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>` Changes the background color to bright yellow. ### `bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>` Changes the foreground color to bright blue. ### `on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>` Changes the background color to bright blue. ``` -------------------------------- ### type_id Source: https://docs.rs/oopsie/latest/oopsie/struct.ErrorCode.html Gets the `TypeId` of `self`. ```APIDOC ## fn type_id(&self) -> TypeId ### Description Gets the `TypeId` of `self`. ### Method `type_id` ### Parameters None ### Response - **TypeId**: The type identifier of the object. ``` -------------------------------- ### Dynamic Color Methods Source: https://docs.rs/oopsie/latest/oopsie/struct.Style.html Methods for setting foreground and background colors dynamically. ```APIDOC ## color ### Description 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`. ### Method `color(color: Color)` ### Parameters #### Path Parameters - **color** (Color) - Required - The color to apply. ## on_color ### Description 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`. ### Method `on_color(color: Color)` ### Parameters #### Path Parameters - **color** (Color) - Required - The color to apply. ## fg_rgb ### Description Set the foreground color to a specific RGB value. ### Method `fg_rgb()` ## bg_rgb ### Description Set the background color to a specific RGB value. ### Method `bg_rgb()` ## truecolor ### Description Sets the foreground color to an RGB value. ### Method `truecolor(r: u8, g: u8, b: u8)` ### Parameters #### Path Parameters - **r** (u8) - Required - Red component of the RGB color. - **g** (u8) - Required - Green component of the RGB color. - **b** (u8) - Required - Blue component of the RGB color. ## on_truecolor ### Description Sets the background color to an RGB value. ### Method `on_truecolor(r: u8, g: u8, b: u8)` ### Parameters #### Path Parameters - **r** (u8) - Required - Red component of the RGB color. - **g** (u8) - Required - Green component of the RGB color. - **b** (u8) - Required - Blue component of the RGB color. ``` -------------------------------- ### Type Information Source: https://docs.rs/oopsie/latest/oopsie/extras/env_vars/struct.HomeVarName.html Method to get the TypeId of an object. ```APIDOC ## Any for T ### Description Gets the `TypeId` of `self`. ### Method `type_id` ### Endpoint N/A (SDK Method) ### Parameters None ### Request Example None ### Response #### Success Response - `TypeId`: The unique identifier for the type of `self`. #### Response Example None ``` -------------------------------- ### get_color_mode Source: https://docs.rs/oopsie/latest/oopsie/fn.get_color_mode.html Get the current global color mode. ```APIDOC ## get_color_mode ### Description Get the current global color mode. ### Signature ```rust pub fn get_color_mode() -> ColorMode ``` ### Returns - `ColorMode`: The current global color mode. ``` -------------------------------- ### Run a function and return a Report Source: https://docs.rs/oopsie/latest/src/oopsie/report.rs.html Runs the given function and returns a `Report` with the result. Installs a panic hook and sets a trace marker for the duration of the function. ```rust pub fn run(func: F) -> Self where F: FnOnce() -> Result<(), E>, { crate::panic_hook::acquire_hook(); // `set_hook` panics on a panicking thread, so restoring from a `Drop` // guard would abort during unwind. Catch the unwind instead: the hook ``` -------------------------------- ### Panic Hook Function Source: https://docs.rs/oopsie/latest/oopsie/all.html Function to install a custom panic hook. ```APIDOC ### `install_panic_hook` #### Description Installs a custom panic hook for handling panics. ``` -------------------------------- ### bg Source: https://docs.rs/oopsie/latest/oopsie/struct.ErrorCode.html Set the background color generically. ```APIDOC ## fn bg(&self) -> BgColorDisplay<'_, C, Self> ### Description Set the background color generically. ### Method `bg` ### Parameters None ### Response - **BgColorDisplay<'_, C, Self>**: A displayable object with the background color set. ``` -------------------------------- ### Nord Theme Source: https://docs.rs/oopsie/latest/oopsie/struct.Theme.html Represents the Nord color theme. Use this preset and install it with `set_theme`. ```rust pub const NORD: Self ``` -------------------------------- ### Create HelpText from static string Source: https://docs.rs/oopsie/latest/oopsie/struct.HelpText.html Build a new `HelpText` from a `&'static str`. This is a const function. ```rust pub const fn from_static(s: &'static str) -> HelpText ``` -------------------------------- ### Dracula Theme Source: https://docs.rs/oopsie/latest/oopsie/struct.Theme.html Represents the Dracula color theme. Use this preset and install it with `set_theme`. ```rust pub const DRACULA: Self ``` -------------------------------- ### Iterate Over Slice Elements Source: https://docs.rs/oopsie/latest/oopsie/extras/struct.EnvArgs.html Creates an iterator that yields references to each element in the slice from start to end. ```rust let x = &[1, 2, 4]; let mut iterator = x.iter(); assert_eq!(iterator.next(), Some(&1)); assert_eq!(iterator.next(), Some(&2)); assert_eq!(iterator.next(), Some(&4)); assert_eq!(iterator.next(), None); ``` -------------------------------- ### Create HelpText from String Source: https://docs.rs/oopsie/latest/oopsie/struct.HelpText.html Build a new `HelpText` from a `String`. This is a const function. ```rust pub const fn from_string(s: String) -> HelpText ``` -------------------------------- ### Create a new Style Source: https://docs.rs/oopsie/latest/src/oopsie/style.rs.html Initialize a new Style with default settings, which results in no ANSI codes being emitted. This is the starting point for building custom styles. ```rust pub const fn new() -> Self { Self(owo_colors::Style::new()) } ``` -------------------------------- ### Define start_marker Macro Source: https://docs.rs/oopsie/latest/oopsie/macro.start_marker.html This macro defines the start_marker functionality. Frames below this call are hidden from rendered error and panic traces. A later call replaces the marker. ```rust macro_rules! start_marker { () => { ... }; } ``` -------------------------------- ### Clone for HelpText Source: https://docs.rs/oopsie/latest/oopsie/struct.HelpText.html Enables cloning of HelpText instances. ```APIDOC ## fn clone(&self) -> HelpText ### Description Returns a duplicate of the value. ### Method `clone` ### Parameters - `self`: A reference to the HelpText instance. ### Returns - `HelpText`: A new, cloned HelpText instance. ``` ```APIDOC ## fn clone_from(&mut self, source: &Self) ### Description Performs copy-assignment from `source`. ### Method `clone_from` ### Parameters - `self`: A mutable reference to the HelpText instance. - `source`: A reference to the HelpText instance to copy from. ``` -------------------------------- ### Get SpanTrace Status Source: https://docs.rs/oopsie/latest/oopsie/struct.SpanTrace.html Returns the status of the SpanTrace, indicating whether it was captured, is empty, or unsupported. ```rust pub fn status(&self) -> SpanTraceStatus ``` -------------------------------- ### Get TypeId of Self Source: https://docs.rs/oopsie/latest/oopsie/extras/env_vars/struct.PathVarName.html Retrieves the `TypeId` of the current instance. This is useful for runtime type identification. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### TraceTheme::clone_from Source: https://docs.rs/oopsie/latest/oopsie/trace_printer/struct.TraceTheme.html Performs copy-assignment from `source`. ```APIDOC ## fn clone_from(&mut self, source: &Self) ### Description Performs copy-assignment from `source`. ### Signature fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Get Captured Backtrace Snapshot Source: https://docs.rs/oopsie/latest/oopsie/erased/struct.ErasedError.html Retrieves the captured backtrace snapshot, if one was transported with the error. ```rust pub const fn backtrace(&self) -> Option<&ErasedBacktrace> ``` -------------------------------- ### Get Captured Caller-Location Snapshot Source: https://docs.rs/oopsie/latest/oopsie/erased/struct.ErasedError.html Retrieves the captured caller-location snapshot, if one was transported with the error. ```rust pub const fn location(&self) -> Option<&ErasedLocation> ``` -------------------------------- ### Color and Style Methods Source: https://docs.rs/oopsie/latest/oopsie/erased/struct.ErasedSpan.html Methods for changing foreground and background colors, and applying various text styles. ```APIDOC ## on_bright_yellow ### Description Change the background color to bright yellow ### Method `on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>` ## bright_blue ### Description Change the foreground color to bright blue ### Method `bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>` ## on_bright_blue ### Description Change the background color to bright blue ### Method `on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>` ## bright_magenta ### Description Change the foreground color to bright magenta ### Method `bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>` ## on_bright_magenta ### Description Change the background color to bright magenta ### Method `on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>` ## bright_purple ### Description Change the foreground color to bright purple ### Method `bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>` ## on_bright_purple ### Description Change the background color to bright purple ### Method `on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>` ## bright_cyan ### Description Change the foreground color to bright cyan ### Method `bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>` ## on_bright_cyan ### Description Change the background color to bright cyan ### Method `on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>` ## bright_white ### Description Change the foreground color to bright white ### Method `bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>` ## on_bright_white ### Description Change the background color to bright white ### Method `on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>` ## bold ### Description Make the text bold ### Method `bold(&self) -> BoldDisplay<'_, Self>` ## dimmed ### Description Make the text dim ### Method `dimmed(&self) -> DimDisplay<'_, Self>` ## italic ### Description Make the text italicized ### Method `italic(&self) -> ItalicDisplay<'_, Self>` ## underline ### Description Make the text underlined ### Method `underline(&self) -> UnderlineDisplay<'_, Self>` ## blink ### Description Make the text blink ### Method `blink(&self) -> BlinkDisplay<'_, Self>` ## blink_fast ### Description Make the text blink (but fast!) ### Method `blink_fast(&self) -> BlinkFastDisplay<'_, Self>` ## reversed ### Description Swap the foreground and background colors ### Method `reversed(&self) -> ReversedDisplay<'_, Self>` ## hidden ### Description Hide the text ### Method `hidden(&self) -> HiddenDisplay<'_, Self>` ## strikethrough ### Description Cross out the text ### Method `strikethrough(&self) -> StrikeThroughDisplay<'_, Self>` ## color ### Description 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`. ### Method `color(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>` where Color: DynColor ## on_color ### Description 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`. ### Method `on_color(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>` where Color: DynColor ## fg_rgb ### Description Set the foreground color to a specific RGB value. ### Method `fg_rgb( &self, ) -> FgColorDisplay<'_, CustomColor, Self>` ## bg_rgb ### Description Set the background color to a specific RGB value. ### Method `bg_rgb( &self, ) -> BgColorDisplay<'_, CustomColor, Self>` ## truecolor ### Description Sets the foreground color to an RGB value. ### Method `truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>` ## on_truecolor ### Description Sets the background color to an RGB value. ### Method `on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>` ## style ### Description Apply a runtime-determined style ### Method `style(&self, style: Style) -> Styled<&Self>` ``` -------------------------------- ### Serialize for HelpText Source: https://docs.rs/oopsie/latest/oopsie/struct.HelpText.html Allows HelpText instances to be serialized. ```APIDOC ## fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> ### Description Serialize this value into the given Serde serializer. ### Method `serialize` ### Parameters - `self`: A reference to the HelpText instance. - `__serializer`: The Serde serializer. ### Returns - `Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>`: A result indicating success or failure during serialization. ``` -------------------------------- ### Get Source Chain Source: https://docs.rs/oopsie/latest/oopsie/erased/struct.ErasedError.html Returns the Display implementation of each transported cause, ordered from outermost to innermost. ```rust pub fn source_chain(&self) -> &[Box] ``` -------------------------------- ### OwoColorize Implementations for ColorMode Source: https://docs.rs/oopsie/latest/oopsie/enum.ColorMode.html Demonstrates the OwoColorize trait implementations for ColorMode, allowing for easy text coloring. ```APIDOC ## OwoColorize Implementations for ColorMode This section details the methods available on `ColorMode` through the `OwoColorize` trait for setting text colors. ### `fg(&self) -> FgColorDisplay<'_, C, Self>` Sets the foreground color generically. ### `bg(&self) -> BgColorDisplay<'_, C, Self>` Sets the background color generically. ### `black(&self) -> FgColorDisplay<'_, Black, Self>` Changes the foreground color to black. ### `on_black(&self) -> BgColorDisplay<'_, Black, Self>` Changes the background color to black. ### `red(&self) -> FgColorDisplay<'_, Red, Self>` Changes the foreground color to red. ### `on_red(&self) -> BgColorDisplay<'_, Red, Self>` Changes the background color to red. ### `green(&self) -> FgColorDisplay<'_, Green, Self>` Changes the foreground color to green. ### `on_green(&self) -> BgColorDisplay<'_, Green, Self>` Changes the background color to green. ### `yellow(&self) -> FgColorDisplay<'_, Yellow, Self>` Changes the foreground color to yellow. ### `on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>` Changes the background color to yellow. ### `blue(&self) -> FgColorDisplay<'_, Blue, Self>` Changes the foreground color to blue. ### `on_blue(&self) -> BgColorDisplay<'_, Blue, Self>` Changes the background color to blue. ### `magenta(&self) -> FgColorDisplay<'_, Magenta, Self>` Changes the foreground color to magenta. ### `on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>` Changes the background color to magenta. ### `purple(&self) -> FgColorDisplay<'_, Magenta, Self>` Changes the foreground color to purple. ### `on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>` Changes the background color to purple. ### `cyan(&self) -> FgColorDisplay<'_, Cyan, Self>` Changes the foreground color to cyan. ### `on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>` Changes the background color to cyan. ### `white(&self) -> FgColorDisplay<'_, White, Self>` Changes the foreground color to white. ### `on_white(&self) -> BgColorDisplay<'_, White, Self>` Changes the background color to white. ### `default_color(&self) -> FgColorDisplay<'_, Default, Self>` Changes the foreground color to the terminal default. ### `on_default_color(&self) -> BgColorDisplay<'_, Default, Self>` Changes the background color to the terminal default. ### `bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>` Changes the foreground color to bright black. ### `on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>` Changes the background color to bright black. ### `bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>` Changes the foreground color to bright red. ### `on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>` Changes the background color to bright red. ### `bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>` Changes the foreground color to bright green. ### `on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>` Changes the background color to bright green. ### `bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>` Changes the foreground color to bright yellow. ### `on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>` Changes the background color to bright yellow. ``` -------------------------------- ### Get Span Level Source: https://docs.rs/oopsie/latest/oopsie/erased/struct.ErasedMetadata.html Retrieves the verbosity level of the tracing span. This is a constant function for efficiency. ```rust pub const fn level(&self) -> TracingLevel ``` -------------------------------- ### Get Trace Theme Source: https://docs.rs/oopsie/latest/oopsie/struct.Theme.html Bundles the trace roles into a TraceTheme for TracePrinter. This method is part of the Theme implementation. ```rust pub const fn trace(&self) -> TraceTheme ```