Allow for custom traits - #6
Conversation
|
Hello @kaimast, thank you for your contribution. I will check it as soon as possible. |
|
Hello @kaimast, if let Some(string_opt) = value.downcast_ref::<Option<String>>() {
if let Some(string) = string_opt.as_deref() {
return Some((key.to_string(), format!("{}", string)));
}
}This snippet would no longer work as intended, affecting users' existing code. To preserve backward compatibility while adopting your suggested improvements, I'm considering introducing a new trait, Looking forward to your thoughts. |
|
Sorry for the delay. Could you take a look at the example I added ("examples/any.rs"). I think what you describe still works. The only difference is that the generated trait now has an Item field. I can add a separate trait like you suggested, but it would introduce some code duplication. Also, I would suggest adding basic CI to the repository so that pull requests can be tested. I can make another pull request that adds Github Actions if you want. |
…e drafts - README rewritten for 0.2.0: no_std/zero-alloc pitch, mutation and custom-trait-object sections with compiling examples, updated comparison table, and a 'Migrating from 0.1' table leading with 'the common path needs no changes' - CHANGELOG 0.2.0 entry: additions, explicit Breaking items, credit lines for @mjhouse (#3/#4), @kaimast (#6) and @srid (#5), fixed-issue links, migration table - release-plz config + workflow (lockstep version_group, semver_check, single v{version} tag; release job inert until CARGO_REGISTRY_TOKEN is configured); CONTRIBUTING release section documents the PR flow and the manual publish order derive -> facade -> internal (the shim now depends on the facade, so it goes last) - docs/maintainer/triage-drafts.md: ready-to-paste comments for issues #1/#2/#5/#7 and PR #6, a pinned roadmap issue draft, and a publish-day checklist — nothing is posted automatically - new custom_trait example; config_validation now also shows field_mut Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
I took a stab at #5 and added an example. Let me know what you think! I also re-organized the top-level Cargo.toml a little to make examples work correctly.