Skip to main content

GraphError

Enum GraphError 

Source
#[non_exhaustive]
pub enum GraphError {
Show 20 variants Render(String), Io(Error), Curve(CurveError), Surface(SurfaceError), Decimal(Box<DecimalError>), Backtest(Box<BacktestError>), InvalidDimensions { width: u32, height: u32, }, TooSmall { width: u32, height: u32, min_width: u32, min_height: u32, }, NoRoom { width: u32, height: u32, }, InvalidLineWidth { name: String, width: f64, }, LengthMismatch { name: String, x: usize, y: usize, }, SurfaceLengthMismatch { name: String, x: usize, y: usize, z: usize, }, DegenerateSurface { name: String, columns: usize, rows: usize, }, DuplicateSurfacePoint { name: String, x: Decimal, y: Decimal, }, IncompleteSurface { name: String, expected: usize, found: usize, }, NotRepresentable(Decimal), InvalidColor { color: String, reason: String, }, MissingGlyph { character: char, code: u32, text: String, }, NotXmlText { character: char, code: u32, text: String, }, UnsupportedText(String),
}
Expand description

Represents errors that can occur during graph generation and rendering operations.

This error type encapsulates failures that may happen when creating, rendering, or saving graphical representations of financial data such as option chains, volatility surfaces, or strategy payoffs.

The PNG and SVG export (static_export) reports data it cannot draw faithfully with its own variants rather than repairing it: a surface with missing or repeated grid points, series whose coordinate arrays differ in length, a colour or a label character it cannot reproduce. The enum is #[non_exhaustive]: match it with a wildcard arm, since later releases may add variants.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Render(String)

Represents errors that occur during the rendering process. Contains a descriptive message about what went wrong.

§

Io(Error)

Represents I/O errors that occur when reading from or writing to files (e.g., when saving graphs to disk).

§

Curve(CurveError)

Error from curve operations.

§

Surface(SurfaceError)

Error from surface operations.

§

Decimal(Box<DecimalError>)

A figure a report derives for display (a total, an average) left the representable Decimal range.

§

Backtest(Box<BacktestError>)

The backtest figures a report shows could not be computed, for example when the statistics of a SimulationStats accumulator overflow Decimal.

§

InvalidDimensions

The configured figure width or height is zero or larger than the 16384 pixels the static export draws.

Fields

§width: u32

Configured width in pixels.

§height: u32

Configured height in pixels.

§

TooSmall

The figure is too small to lay the chart out.

Fields

§width: u32

Configured width in pixels.

§height: u32

Configured height in pixels.

§min_width: u32

Smallest width the chart is laid out in.

§min_height: u32

Smallest height the chart is laid out in.

§

NoRoom

The title, legend or colour bar leave no pixels to draw the chart in.

Fields

§width: u32

Configured width in pixels.

§height: u32

Configured height in pixels.

§

InvalidLineWidth

A line width is not a finite number of pixels between 0 and 100.

Fields

§name: String

Name of the series.

§width: f64

The width given.

§

LengthMismatch

A 2D series has a different number of x and y values. Plotly drew the shorter length; the static export does not drop points.

Fields

§name: String

Name of the series.

§x: usize

Number of x values.

§y: usize

Number of y values.

§

SurfaceLengthMismatch

A surface has a different number of x, y and z values.

Fields

§name: String

Name of the surface.

§x: usize

Number of x values.

§y: usize

Number of y values.

§z: usize

Number of z values.

§

DegenerateSurface

A surface needs at least two distinct x and two distinct y values.

Fields

§name: String

Name of the surface.

§columns: usize

Distinct x values.

§rows: usize

Distinct y values.

§

DuplicateSurfacePoint

A surface grid point appears more than once. Plotly kept the last value; the static export does not choose.

Fields

§name: String

Name of the surface.

§x: Decimal

x of the repeated point.

§y: Decimal

y of the repeated point.

§

IncompleteSurface

A surface grid point is missing: expected is distinct x times distinct y, found the number of points given. Plotly filled the gaps with zero; the static export does not invent values.

Fields

§name: String

Name of the surface.

§expected: usize

Points a complete grid has.

§found: usize

Points the surface has.

§

NotRepresentable(Decimal)

A value has no f64 representation for drawing.

§

InvalidColor

A colour string is none of the CSS Color 4 forms the static export accepts: a named colour, #rgb, #rgba, #rrggbb, #rrggbbaa, rgb()/rgba() or hsl()/hsla().

Fields

§color: String

The string as given.

§reason: String

Why it was rejected.

§

MissingGlyph

A label uses a character the bundled font has no glyph for. The static export never substitutes or drops it.

Fields

§character: char

The character without a glyph.

§code: u32

Its code point, for display.

§text: String

The whole label.

§

NotXmlText

A label, or the chart title or description an SVG carries, contains a character XML 1.0 cannot represent: a C0 control other than tab, line feed and carriage return, U+FFFE or U+FFFF.

Fields

§character: char

The character XML cannot carry.

§code: u32

Its code point, for display.

§text: String

The string it was found in.

§

UnsupportedText(String)

Text the static export cannot draw: a font style other than the bundled regular face, or SVG text outside the form it converts.

Trait Implementations§

Source§

impl Debug for GraphError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for GraphError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for GraphError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<BacktestError> for GraphError

Source§

fn from(err: BacktestError) -> Self

Converts to this type from the input type.
Source§

impl From<CurveError> for GraphError

Source§

fn from(err: CurveError) -> Self

Converts to this type from the input type.
Source§

impl From<DecimalError> for GraphError

Source§

fn from(err: DecimalError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for GraphError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<SurfaceError> for GraphError

Source§

fn from(err: SurfaceError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> ErasedDestructor for T
where T: 'static,

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<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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<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