udoprog / genco

A whitespace-aware quasiquoter for beautiful code generation.
Apache License 2.0
183 stars 12 forks source link

Add a new function for creating java Extra instance. #5

Closed sidneywang closed 5 years ago

sidneywang commented 5 years ago

I want to call write_file in Java class, but Extra can't be created because of private field imported in Extra. So, I added a new function to create Extra instance.

java::Java::write_file(class.into_tokens(), &mut formatter, &mut extra, 1)?;
udoprog commented 5 years ago

You can create an Extra instance using its Default impl:

let mut extra = Extra::default();
sidneywang commented 5 years ago

OK, it works, even though I need two steps to create an instance.