Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

:dep thiserror = "1.0.25"
use thiserror::Error;

#[derive(Error, Debug)]
pub enum ParseRankError {
    #[error("{0} is not a valid symbol for card rank!")]
    InvalidSymbol(char),
    #[error("{0} is not a valid integer for card rank!")]
    InvalidInteger(u8),
}
:dep tracing = "0.1.26"
use tracing::{debug, error, info, span, warn, Level};
let e = ParseRankError::InvalidSymbol('m');
e
InvalidSymbol('m')
e.to_string()
"m is not a valid symbol for card rank!"
#[tracing::instrument]
fn f(){
    let e = ParseRankError::InvalidSymbol('m');
    warn!("{}", e);
}
f()
()
error!("{}", e);
info!("{}", e);
use tracing::error;

let (err_info, port) = ("No connection", 22);

error!(port, error = %err_info);
error!(target: "app_events", "App Error: {}", err_info);
error!({ info = err_info }, "error on port: {}", port);