Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo Gen Organized Output #764

Merged

Conversation

ambiguousname
Copy link
Member

@ambiguousname ambiguousname commented Jan 17, 2025

Fixes #609.

Looks much more human readable now, with output like:

export function formatWrite(name, grouping_strategy, some_other_config, v) {
    
    let locale = new Locale(name);
    
    let provider = DataProvider.newStatic();
    
    let options = FixedDecimalFormatterOptions.fromFields({
        groupingStrategy: grouping_strategy,
        someOtherConfig: some_other_config
    });
    
    let self = FixedDecimalFormatter.tryNew(locale,provider,options);
    
    let value = new FixedDecimal(v);
    
    let out = self.formatWrite(value);
    

    return out;
}

Quite a few TODOs with this one:

  • Global variable name collision avoidance
    • Tests
  • Recursive variable name (based on the variable it will be used for)
    • Tests
  • Rename all self parameters to something based on the type name
  • Calling a getter
    • Tests
  • Remove all associated TODOs from terminus.rs (once these are checked off)
  • Update docs/demo_gen.md

@ambiguousname ambiguousname added the B-demo_gen Demo_Gen backend label Jan 17, 2025
@ambiguousname ambiguousname marked this pull request as ready for review January 21, 2025 18:37
@ambiguousname
Copy link
Member Author

ambiguousname commented Jan 21, 2025

Most of the other TODOs are pretty small fixes in comparison, but all the main changes are here

@ambiguousname
Copy link
Member Author

Once this is merged, I'll also update the quickstart repo to use this new generation style

@Manishearth Manishearth merged commit a80a6a0 into rust-diplomat:main Jan 22, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-demo_gen Demo_Gen backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Demo_Gen: Better Organized Output
2 participants