ct-austin / ifmt Goto Github PK
View Code? Open in Web Editor NEWInline expression interpolation for Rust.
Home Page: https://crates.io/crates/ifmt
License: Other
Inline expression interpolation for Rust.
Home Page: https://crates.io/crates/ifmt
License: Other
[INFO] [stderr] Compiling ifmt-impl v0.3.0
[INFO] [stderr] error: expected identifier
[INFO] [stderr] --> /opt/rustwide/cargo-home/registry/src/github.com-1ecc6299db9ec823/ifmt-impl-0.3.0/src/lib.rs:87:16
[INFO] [stderr] |
[INFO] [stderr] 87 | pub fn $name(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
[INFO] [stderr] | ^^^^^
[INFO] [stderr] ...
[INFO] [stderr] 97 | def_ifmt_macro!(iformat, format);
[INFO] [stderr] | --------------------------------- in this macro invocation
[INFO] [stderr] |
[INFO] [stderr] = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stderr]
[INFO] [stderr] error: expected identifier
[INFO] [stderr] --> /opt/rustwide/cargo-home/registry/src/github.com-1ecc6299db9ec823/ifmt-impl-0.3.0/src/lib.rs:87:16
[INFO] [stderr] |
[INFO] [stderr] 87 | pub fn $name(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
[INFO] [stderr] | ^^^^^
[INFO] [stderr] ...
[INFO] [stderr] 99 | def_ifmt_macro!(iprint, print);
[INFO] [stderr] | ------------------------------- in this macro invocation
[INFO] [stderr] |
[INFO] [stderr] = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stderr]
[INFO] [stderr] error: expected identifier
[INFO] [stderr] --> /opt/rustwide/cargo-home/registry/src/github.com-1ecc6299db9ec823/ifmt-impl-0.3.0/src/lib.rs:87:16
[INFO] [stderr] |
[INFO] [stderr] 87 | pub fn $name(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
[INFO] [stderr] | ^^^^^
[INFO] [stderr] ...
[INFO] [stderr] 101 | def_ifmt_macro!(iprintln, println);
[INFO] [stderr] | ----------------------------------- in this macro invocation
[INFO] [stderr] |
[INFO] [stderr] = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stderr]
[INFO] [stderr] error: expected identifier
[INFO] [stderr] --> /opt/rustwide/cargo-home/registry/src/github.com-1ecc6299db9ec823/ifmt-impl-0.3.0/src/lib.rs:87:16
[INFO] [stderr] |
[INFO] [stderr] 87 | pub fn $name(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
[INFO] [stderr] | ^^^^^
[INFO] [stderr] ...
[INFO] [stderr] 103 | def_ifmt_macro!(ieprint, eprint);
[INFO] [stderr] | --------------------------------- in this macro invocation
[INFO] [stderr] |
[INFO] [stderr] = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stderr]
[INFO] [stderr] error: expected identifier
[INFO] [stderr] --> /opt/rustwide/cargo-home/registry/src/github.com-1ecc6299db9ec823/ifmt-impl-0.3.0/src/lib.rs:87:16
[INFO] [stderr] |
[INFO] [stderr] 87 | pub fn $name(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
[INFO] [stderr] | ^^^^^
[INFO] [stderr] ...
[INFO] [stderr] 105 | def_ifmt_macro!(ieprintln, eprintln);
[INFO] [stderr] | ------------------------------------- in this macro invocation
[INFO] [stderr] |
[INFO] [stderr] = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stderr]
[INFO] [stderr] error: expected identifier
[INFO] [stderr] --> /opt/rustwide/cargo-home/registry/src/github.com-1ecc6299db9ec823/ifmt-impl-0.3.0/src/lib.rs:87:16
[INFO] [stderr] |
[INFO] [stderr] 87 | pub fn $name(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
[INFO] [stderr] | ^^^^^
[INFO] [stderr] ...
[INFO] [stderr] 107 | def_ifmt_macro!(iformat_args, format_args);
[INFO] [stderr] | ------------------------------------------- in this macro invocation
[INFO] [stderr] |
[INFO] [stderr] = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stderr]
[INFO] [stderr] error: expected identifier
[INFO] [stderr] --> /opt/rustwide/cargo-home/registry/src/github.com-1ecc6299db9ec823/ifmt-impl-0.3.0/src/lib.rs:87:16
[INFO] [stderr] |
[INFO] [stderr] 87 | pub fn $name(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
[INFO] [stderr] | ^^^^^
[INFO] [stderr] ...
[INFO] [stderr] 109 | def_ifmt_macro!(ipanic, panic);
[INFO] [stderr] | ------------------------------- in this macro invocation
[INFO] [stderr] |
[INFO] [stderr] = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stderr]
[INFO] [stderr] error: aborting due to 7 previous errors
[INFO] [stderr]
[INFO] [stderr] error: could not compile `ifmt-impl`.
Hi! First of all, thanks for this lib. It is so nicer to write rust code using it!
Secondly, I think there is a small room for improvement. For example, why don't we allow the following code to compile?
iprintln!(canvas.code());
It should be converted either to iprintln!("{}", canvas.code());
or to iprintln!("{:?}", canvas.code());
. I prefer the latter, but I'm ok with both. In any case, that would allow us for much simpler usage in many cases.
Thanks! :)
This is not a major showstopper but thought you should know.
I am using iwriteln!
and if I just include a single &str
the macro panics. Here is an example:
iwriteln!(&mut code, "}")?;
The error says unmatched }
.
Then I tried this:
iwriteln!(&mut code, "abc }")?;
Still got a panic, but not the same message.
I worked around it by doing this:
iwriteln!(&mut code, "}" "")?;
So it appears that a variable or another expression is always required. If that is intentional adding that to the doc would help.
Great job by the way, as you can see I am doing some code-gen, ifmt
is going to make it pretty easy to do.
The docs describe it as "old", and I'm not sure if I should take this to mean deprecated. It's still more convenient to not have to terminate and restart the string literal each time I want to print something, esp. if I am editing and changing my mind about where in the string I want to put my expressions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.