Skip to content

Add target filtering for defines#287

Open
micprog wants to merge 1 commit intomasterfrom
define_trgt
Open

Add target filtering for defines#287
micprog wants to merge 1 commit intomasterfrom
define_trgt

Conversation

@micprog
Copy link
Member

@micprog micprog commented Mar 4, 2026

Fixes #40

@micprog micprog requested a review from fischeti March 4, 2026 11:19
Copy link
Contributor

@fischeti fischeti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Maybe an example could be added to the README? or do you want to wait for the official book?🤓

Comment on lines +110 to +137
fn visit_bool<E>(self, value: bool) -> std::result::Result<T, E>
where
E: de::Error,
{
self.visit_str(if value { "true" } else { "false" })
}

fn visit_i64<E>(self, value: i64) -> std::result::Result<T, E>
where
E: de::Error,
{
self.visit_str(&value.to_string())
}

fn visit_u64<E>(self, value: u64) -> std::result::Result<T, E>
where
E: de::Error,
{
self.visit_str(&value.to_string())
}

fn visit_f64<E>(self, value: f64) -> std::result::Result<T, E>
where
E: de::Error,
{
self.visit_str(&value.to_string())
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to write this as a generic function? E.g. something like:

            fn visit_bool<E>(self, value: T) -> std::result::Result<T, E>
            where
                T: ToString
                E: de::Error,
            {
                self.visit_str(&value.to_string())
            }       

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Target-specific defines for all files

2 participants