pub struct Traceback { /* private fields */ }Expand description
Renders a traceback with Rich formatting.
Mimics Python Rich’s rich.traceback.Traceback renderable.
Implementations§
Source§impl Traceback
impl Traceback
Sourcepub fn from_exception(
exc_type: impl Into<String>,
exc_value: impl Into<String>,
frames: Vec<Frame>,
) -> Self
pub fn from_exception( exc_type: impl Into<String>, exc_value: impl Into<String>, frames: Vec<Frame>, ) -> Self
Convenience constructor: build a Traceback from an exception type,
value, and list of frames.
Sourcepub fn code_width(self, width: usize) -> Self
pub fn code_width(self, width: usize) -> Self
Builder: set the width reserved for source code (excluding line numbers).
Sourcepub fn extra_lines(self, n: usize) -> Self
pub fn extra_lines(self, n: usize) -> Self
Builder: set the number of extra source lines shown before and after the error line.
Sourcepub fn theme(self, theme: impl Into<String>) -> Self
pub fn theme(self, theme: impl Into<String>) -> Self
Builder: set the theme name (e.g. "monokai", "base16-ocean.dark").
Sourcepub fn word_wrap(self, wrap: bool) -> Self
pub fn word_wrap(self, wrap: bool) -> Self
Builder: enable or disable word wrapping of long lines.
Sourcepub fn show_locals(self, show: bool) -> Self
pub fn show_locals(self, show: bool) -> Self
Builder: show local variables at each frame when set to true.
Sourcepub fn indent_guides(self, guides: bool) -> Self
pub fn indent_guides(self, guides: bool) -> Self
Builder: enable indentation guides in source context.
Sourcepub fn locals_max_length(self, n: usize) -> Self
pub fn locals_max_length(self, n: usize) -> Self
Builder: set the maximum number of local variables to display per frame.
Sourcepub fn locals_max_string(self, n: usize) -> Self
pub fn locals_max_string(self, n: usize) -> Self
Builder: set the maximum length for local variable string values.
Sourcepub fn locals_max_depth(self, n: usize) -> Self
pub fn locals_max_depth(self, n: usize) -> Self
Builder: set the maximum depth for nested local variable display.
Sourcepub fn locals_hide_dunder(self, hide: bool) -> Self
pub fn locals_hide_dunder(self, hide: bool) -> Self
Builder: hide locals with dunder names (e.g. __name__) when true.
Sourcepub fn locals_hide_sunder(self, hide: bool) -> Self
pub fn locals_hide_sunder(self, hide: bool) -> Self
Builder: hide locals with underscore-prefixed names (e.g. _secret) when true.
Sourcepub fn suppress(self, suppress: Vec<String>) -> Self
pub fn suppress(self, suppress: Vec<String>) -> Self
Builder: suppress frames whose filename matches any of the given patterns.
Sourcepub fn max_frames(self, n: usize) -> Self
pub fn max_frames(self, n: usize) -> Self
Builder: limit the number of frames shown (remaining are collapsed into a single message).
Trait Implementations§
Source§impl Renderable for Traceback
impl Renderable for Traceback
Source§fn render(&self, options: &ConsoleOptions) -> RenderResult
fn render(&self, options: &ConsoleOptions) -> RenderResult
RenderResult using the provided options. Read moreSource§fn measure(&self, _options: &ConsoleOptions) -> Option<Measurement>
fn measure(&self, _options: &ConsoleOptions) -> Option<Measurement>
__rich_measure__).
Override to provide min/max width constraints for layout.Auto Trait Implementations§
impl Freeze for Traceback
impl RefUnwindSafe for Traceback
impl Send for Traceback
impl Sync for Traceback
impl Unpin for Traceback
impl UnsafeUnpin for Traceback
impl UnwindSafe for Traceback
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more