Enum tinted_builder_rust::TintedBuilderError

source ·
#[non_exhaustive]
pub enum TintedBuilderError { SchemeMissingProperty(String), YamlDeserialize(Error), RibboncurlsRender(RibboncurlsError), ColorRadix(ParseIntError), HexInputFormat, InvalidSchemeVariant(String), InvalidSchemeSystem(String), }
Expand description

Add tinted-builder library test since tinted-builder-rust is exporting the structs

use tinted_builder_rust::{Scheme, Template};

let template = String::from(r#"/* Some CSS file with {{scheme-name}} theme */
.someCssSelector { background-color: #{{base00-hex}} }
.someOtherCssSelector { background-color: #{{base0F-hex}} }"#);
let scheme_str = r#"system: "base16"
name: "UwUnicorn"
author: "Fernando Marques (https://github.com/RakkiUwU) and Gabriel Fontes (https://github.com/Misterio77)"
variant: "dark"
palette:
  base00: "241b26"
  base01: "2f2a3f"
  base02: "46354a"
  base03: "6c3cb2"
  base04: "7e5f83"
  base05: "eed5d9"
  base06: "d9c2c6"
  base07: "e4ccd0"
  base08: "877bb6"
  base09: "de5b44"
  base0A: "a84a73"
  base0B: "c965bf"
  base0C: "9c5fce"
  base0D: "6a9eb5"
  base0E: "78a38f"
  base0F: "a3a079""#;
let scheme = Scheme::Base16(serde_yaml::from_str(&scheme_str).unwrap());
let template = Template::new(template, scheme);
let output = template
    .render()
    .unwrap();

 assert_eq!(output, r#"/* Some CSS file with UwUnicorn theme */
.someCssSelector { background-color: #241b26 }
.someOtherCssSelector { background-color: #a3a079 }"#);

An error type representing the various errors that can occur when using tinted-builder

This error type is non-exhaustive, meaning additional variants may be added in future versions without it being considered a breaking change. The enum variants cover a range of possible issues that might arise during the processing of color schemes, including missing properties, deserialization errors, and rendering issues.

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

SchemeMissingProperty(String)

Error indicating that a required property in the scheme is missing.

This variant is used when a necessary property for the scheme’s configuration is not found.

§

YamlDeserialize(Error)

Error that occurs when YAML deserialization fails.

This variant wraps the serde_yaml::Error and is used when there is an issue converting a YAML string into the corresponding Rust data structure.

§

RibboncurlsRender(RibboncurlsError)

Error that occurs during rendering using Ribboncurls.

This variant wraps the RibboncurlsError and is used when an error is encountered while rendering a template or other content using Ribboncurls.

§

ColorRadix(ParseIntError)

Error that occurs when a string slice cannot be converted to an integer with the given base.

This variant wraps std::num::ParseIntError and is used when a string slice, such as a color value in hexadecimal format, fails to parse correctly.

§

HexInputFormat

Error indicating that a hex color input is not formatted correctly.

This variant is used when a color string that is expected to be in hex format does not match the expected format.

§

InvalidSchemeVariant(String)

Error indicating that an invalid scheme variant was provided.

This variant is used when an input string does not correspond to any valid scheme variant, such as “dark” or “light”.

§

InvalidSchemeSystem(String)

Error indicating that an invalid scheme system was provided.

This variant is used when an input string does not correspond to any valid scheme system

Trait Implementations§

source§

impl Debug for TintedBuilderError

source§

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

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

impl Display for TintedBuilderError

source§

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

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

impl Error for TintedBuilderError

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<Error> for TintedBuilderError

source§

fn from(source: Error) -> TintedBuilderError

Converts to this type from the input type.
source§

impl From<ParseIntError> for TintedBuilderError

source§

fn from(source: ParseIntError) -> TintedBuilderError

Converts to this type from the input type.
source§

impl From<RibboncurlsError> for TintedBuilderError

source§

fn from(source: RibboncurlsError) -> TintedBuilderError

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

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToString for T
where T: Display + ?Sized,

source§

default 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 = 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.