fmt_compare_nostd

Crates.iofmt_compare_nostd
lib.rsfmt_compare_nostd
version0.1.1
sourcesrc
created_at2022-06-26 04:51:49.855706
updated_at2022-06-27 10:30:43.689339
descriptionLibrary for comparing Display and Debug traits against &str without allocation. No_std compatible.
homepage
repositoryhttps://github.com/kosciej/fmt_compare_nostd
max_upload_size
id613397
size6,295
MichaƂ Zabielski (kosciej)

documentation

README

Description

Utility functions for Display/Debug trait comparison in no_std environment.

This crate provides functions to compare output of Display and Debug traits against &str in no_std env. No alloc nor std is used.

Broader description of the issue that this crate solves: StackOverflow

Quick Start

#![no_std]
use fmt_compare_nostd::eq_display;
use core::fmt::{Display, Formatter, Result};
 
struct D {}

impl Display for D {
   fn fmt(&self, f: &mut Formatter<'_>) -> Result {
       write!(f, "Display D")
   }
}

fn main() {
    assert!(eq_display(&D {}, "Display D"));
}
Commit count: 2

cargo fmt