Skip to content

Instantly share code, notes, and snippets.

View bestia-dev's full-sized avatar
☀️

bestia.dev bestia-dev

☀️
View GitHub Profile
@bestia-dev
bestia-dev / macro_format_dbg_1.rs
Last active February 22, 2024 17:56
macro_format_dbg_1.rs
fn main() {
/// copy of the macro dbg!, just modified :#? to :# for pretty print
#[macro_export]
macro_rules! pretty_dbg {
() => {
std::eprintln!("[{}:{}]", std::file!(), std::line!())
};
($val:expr $(,)?) => {
match $val {
tmp => {
@bestia-dev
bestia-dev / macro_pretty_dbg_2.rs
Created February 2, 2024 01:46
Rust playground gists
use serde_json;
use anyhow::Result;
/// copy of the macro dbg!, just modified :#? to :# for pretty print
#[macro_export]
macro_rules! pretty_dbg {
() => {
std::eprintln!("[{}:{}]", std::file!(), std::line!())
};
($val:expr $(,)?) => {
@bestia-dev
bestia-dev / macro_pretty_dbg_1.rs
Created February 2, 2024 01:44
Rust playground gists
/// copy of the macro dbg!, just modified :#? to :# for pretty print
#[macro_export]
macro_rules! pretty_dbg {
() => {
std::eprintln!("[{}:{}]", std::file!(), std::line!())
};
($val:expr $(,)?) => {
match $val {
tmp => {
std::eprintln!("[{}:{}] {} = {:#}",
@bestia-dev
bestia-dev / macro_dbg_2.rs
Created February 2, 2024 01:43
Rust playground gists
use serde_json;
use anyhow::Result;
fn main() -> Result<(), anyhow::Error>{
let response_text =
r#"{
"id": 1296269,
"homepage": "https://github.com"
}"#;
let parsed_json_value: serde_json::Value = serde_json::from_str(response_text)?;
@bestia-dev
bestia-dev / macro_dbg_1.rs
Last active February 2, 2024 01:46
Rust playground gists
fn main() {
let json_str = r#"
{
owner: 'bestia-dev',
repository_details: {
general: {
description: 'testing the creation of a github repo',
},
},
}