Skip to content

RFC: Moving fmt::Display from Predicates to a separate method #41

Closed
@XAMPPRocky

Description

@XAMPPRocky

With adding a way to show predicates with the item being evaluated keeping the current non-evaluated as the Display implementation is a bit confusing as two completely distinct ways of creating a humane readable string. I propose that the fmt::Display implementation be removed and be moved to a seperate method so that's easy to understand that when you want to display a human readable version of a predicate you call either of the methods.

Current

Evaluated

let predicate_fn = predicate::ne(5).not().and(predicate::ge(5));
let (result, output) = predicate_fn.stringify(&5);
println!("{}", output);

Non-evaluated

let predicate_fn = predicate::ne(5).not().and(predicate::ge(5));
println!("{}", predicate_fn);

Proposed

Evaluated

let predicate_fn = predicate::ne(5).not().and(predicate::ge(5));
let (result, output) = predicate_fn.stringify_with_item(&5);
println!("{}", output);

Non-evaluated

let predicate_fn = predicate::ne(5).not().and(predicate::ge(5));
let (result, output) = predicate_fn.stringify();
println!("{}", output);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions