Giter Site home page Giter Site logo

bluss / debugit Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 0.0 13 KB

DebugIt: Use specialization so you can debug-print a value without explicit (and viral) Debug trait bound. (Not really maintained. Uses specialization so it may break)

Home Page: https://docs.rs/debugit

License: Apache License 2.0

Rust 100.00%
rust

debugit's People

Contributors

bluss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

debugit's Issues

I think you should point out the presence of soundness issues in the documentation.

E.g.

use std::fmt;

fn foo<T>(x: T) {
    debugit::debugit!("", x);
}

fn main() {
    use std::cell::RefCell;
    struct Struct<S>(RefCell<S>);
    impl<'a> fmt::Debug for Struct<(&mut &'a str, &'a str)> {
        fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
            let mut this = self.0.borrow_mut();
            *this.0 = this.1;
            Ok(())
        }
    }
    let mut s = "";
    {
        let x = "Hello World!".to_owned();
        foo(Struct(RefCell::new((&mut s, x.as_str()))));
    }
    println!("{}", s); // outputs like "��B�" indicate using the String after its dropped
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.