Skip to content

String in debug() function incorrectly handled #1002

@nicka101

Description

@nicka101

Implementing my own on_debug for the engine is broken due to incorrect handling of the message as a debug string, not the string given to the debug call

To Reproduce:

  1. Implement your own debug function (only the text value given is relevant for this issue):
engine.on_debug(move |text, _, _| {
    println!("DEBUG: {}", text);
});
  1. Call debug from Rhai
debug("test");
  1. Observe that the printed line is NOT the given string, but instead its std::fmt::Debug implementation, despite the print within our debug function specifying std::fmt::Display. We get:

DEBUG: "test"

when we should in fact get:

DEBUG: test

Can debug be changed so that it's given the actual string passed to it, as print is?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions