Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.

Write exported files to target/generated/<crate_name>#31

Merged
VictorKoenders merged 1 commit intobincode-org:trunkfrom
trevyn:target-generated-directory
Nov 2, 2022
Merged

Write exported files to target/generated/<crate_name>#31
VictorKoenders merged 1 commit intobincode-org:trunkfrom
trevyn:target-generated-directory

Conversation

@trevyn
Copy link
Contributor

@trevyn trevyn commented Oct 19, 2022

Unblocks bincode-org/bincode#594 and its duplicate bincode-org/bincode#531 .

As before, if this looks good, a crates.io release of virtue would be appreciated so I can file a PR for bincode.

I elected to use a generated subdirectory as this approach might be used by multiple crates, and it seems reasonable to establish an informal naming standard. Note that IDEs will typically pretty-print directories that only contain a single subdirectory:

Screen Shot 2022-10-19 at 9 06 37 AM

@codecov
Copy link

codecov bot commented Oct 19, 2022

Codecov Report

Base: 40.04% // Head: 39.94% // Decreases project coverage by -0.09% ⚠️

Coverage data is based on head (a680e94) compared to base (34804f0).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk      #31      +/-   ##
==========================================
- Coverage   40.04%   39.94%   -0.10%     
==========================================
  Files          19       19              
  Lines        1878     1860      -18     
==========================================
- Hits          752      743       -9     
+ Misses       1126     1117       -9     
Impacted Files Coverage Δ
src/generate/generator.rs 0.00% <0.00%> (ø)
src/lib.rs 40.57% <0.00%> (-0.02%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

/// The outputted file is unformatted. Use `cargo fmt -- target/<file>.rs` to format the file.
pub fn export_to_file(&self, file_postfix: &str) -> bool {
/// The outputted file is unformatted. Use `cargo fmt -- target/generated/<crate_name>/<file>.rs` to format the file.
pub fn export_to_file(&self, crate_name: &str, file_postfix: &str) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice if we can automatically derive the crate_name ourselves, but I'm not sure if there's a way to do that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I gave this some thought and tried a couple of experiments, but couldn't come up with anything. :( Seems like it might not be possible without maybe exporting a macro or something that starts getting hacky.

@trevyn trevyn force-pushed the target-generated-directory branch from caa3877 to a680e94 Compare November 2, 2022 11:54
@VictorKoenders VictorKoenders merged commit 52d2aa6 into bincode-org:trunk Nov 2, 2022
@VictorKoenders
Copy link
Contributor

Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants