Skip to content

Conversation

@bergmannf
Copy link
Contributor

@bergmannf bergmannf commented Oct 25, 2024

This will just wrap the variables into &str (or &[&str]) constants.

It will also not care about the types of the passed variables, except if they are lists - all other type information doesn't matter - everything will be a &str in the end.

Example:

#+name: mytbl
| A | B |
|---+---|
| a | b |
| c | d |
|   | g |
| e | f |

#+begin_src rust :var A=mytbl :var B='("b" "c") :var C="c"
println!("{:?}", A);
println!("{:?}", B);
println!("{:?}", C);
#+end_src

#+RESULTS:
: [["a", "b"], ["c", "d"], ["", "g"], ["e", "f"]]
: ["b", "c"]
: "c"

This will just wrap the variables into (if needed) nested &[&str]
constants.

It will also not care about the types of the passed variables, except if
they are lists - all other typeinformation doesn't matter - everything
will be a &str in the end.
@CeleritasCelery
Copy link
Contributor

This seems like a big enough addition that it would be worth adding some tests here.

@bergmannf
Copy link
Contributor Author

Ah thanks for the pointer - I only checked where to add it and didn't even check for tests, so 100% agreed on adding some tests! Let me take a look at that.

@CeleritasCelery CeleritasCelery merged commit 2f3c5ff into emacs-rustic:main Oct 25, 2024
3 checks passed
@CeleritasCelery
Copy link
Contributor

Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants