v0.2.0 #4
jngls
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is a complete re-write of the proc macro code and addition of specific impls to address the
Displayblanket impl code gen explosion.It contains breaking changes so be sure to check the migration notes.
Summary
20211.700.2.0prefor specifying prefix, egpre = "prefix_"suffor specifying suffix, egsuf = "_suffix"format!(...), nor did it reduce character counts in syntax attribute arguments, so it was removedcontallows for field or type content replacement and accepts any value that implementsSyntaxFmtcont_withallows for field or type content replacement using functions or closuresindfor specifying indent regions. Actually writing the indentation is now automatic as long as you use the newnlargument.nlfor writing newlines to various locationsbeg(beginning),pre(after prefix),cont(after field or type content),suf(after suffix).nl = [beg, suf]newlinebuilder method ofSyntaxDisplayfor setting newline character sequences, egsyntax_fmt(&...).newline(["", "\r\n"])indentbuilder method ofSyntaxDisplaynow takes array parameter, egsyntax_fmt(&...).indent(["", "\t"])delimcan now optionally take array syntax, egdelim = ["::", " :: "]precan optionally take array syntax, egpre = ["normal_prefix_", "pretty_prefix_"]sufcan optionally take array syntax, egsuf = ["_normal_suffix", "_pretty_suffix"]contcan optionally take array syntax, egcont = ["normal", "***pretty***"]evalallows for conditional field evaluation logic using direct field accesseval_withallows for conditional field evaluation logic using functions or closures#[syntax_else(...)]attribute allows for full formatting ofevalandeval_with"else" caseboundspecifies the trait bound to be passed through for custom formatters and explicitSyntaxFmtimplementationsstatespecifies the concrete state type to be passed through for custom formatters and explicitSyntaxFmtimplementationsBreaking Changes and Migration Notes
format, usepre = "prefix_"and/orsuf = "_suffix"or to define different prefixes and suffixes depending on mode (normal or pretty), usepre = ["normal_prefix_", "pretty_prefix_"]and/orsuf = ["_normal_suffix", "_pretty_suffix"](see Adding Decorations)pretty_format, usepreand/orsufas explained above forformatpretty_delim, usedelim = ["normal", "pretty"]instead (see Collections and Delimiters)empty_suffix, useeval = xyzfollowed by the new attribute#[syntax_else(...)]on a new line (see Conditional Formatting and Fallback Format)indent, remove it (indentation is now automatic as long as you use the newnlarg) (see Indentation and Layout)indent_region, useind(see Indentation and Layout)state_bound, usebound(see Additional State Examples)formatordelimstrings. You can still inline newlines inpre,suf, anddelimstrings, but you should try to instead use the newnlattribute arg as it deals with automatic indentation (see Indentation and Layout)indentattribute on every field or type. Now, all newlines triggered by thenlattribute arg are automatically indented (see Indentation and Layout)This discussion was created from the release v0.2.0.
Beta Was this translation helpful? Give feedback.
All reactions