//! The [`Console`] works as a virtual shell that renders on screen all output of `stdout`. As such, it is useful as a basic interface to show info to the user,
//! The [`Console`] works as a virtual shell that renders on screen all output of `stdout`. As such, it is useful as a basic interface to show info to the user,
//! such as in simple "Hello World" applications or more complex software that does not need much user interaction.
//! such as in simple "Hello World" applications or more complex software that does not need much user interaction.
//!
//!
//! Have a look at [`Soc::redirect_to_3dslink()`](crate::services::soc::Soc::redirect_to_3dslink) for a better alternative when debugging applications.
//! Have a look at [`redirect_stderr`] or [`Soc::redirect_to_3dslink`](crate::services::soc::Soc::redirect_to_3dslink) for better alternatives when debugging applications.
/// Destination for stderr redirection with [`redirect_stderr`].
#[doc(alias = "debugDevice")]
#[repr(u32)]
pubenumDestination{
/// Print stderr to the active [`Console`] window. This is the default behavior.
Console=ctru_sys::debugDevice_CONSOLE,
/// Print stderr via [`ctru_sys::svcOutputDebugString`]. This allows you to capture error and panic messages with `GDB` or other debuggers.
Debugger=ctru_sys::debugDevice_SVC,
/// Swallow outputs from stderr.
Null=ctru_sys::debugDevice_NULL,
}
/// A [`Screen`] that can be used as a target for [`Console`].
/// A [`Screen`] that can be used as a target for [`Console`].
pubtraitConsoleScreen: Screen+Swap+Flush{}
pubtraitConsoleScreen: Screen+Swap+Flush{}
impl<S: Screen+Swap+Flush>ConsoleScreenforS{}
impl<S: Screen+Swap+Flush>ConsoleScreenforS{}
@ -66,6 +79,12 @@ pub struct Console<'screen> {
screen: RefMut<'screen,dynConsoleScreen>,
screen: RefMut<'screen,dynConsoleScreen>,
}
}
/// Send output from stderr to the specified [`Destination`]. This function can be used to capture error and panic messages with `GDB` or other debuggers.