Follow

Use rust they said… It's awesome they said…

I never failed so hard on merging two strings together in any other language…, even C is trivial here by using the strcpy. Not without danger, but trivial.

Maybe someone has mercy and can explain my what I'm doing wrong? 😥

git.shivering-isles.com/sheogo

@r3pek @sheogorath You've made two mistakes in the result definition. "" is "&'static str" not String. And it has to be mutable for "+ &str" to work.

@mike

Thank you so much! That was a kind of weird situation I was in there .-. This explanation makes it clear.

@r3pek

@sheogorath How did you write the whole thing while making a few silly mistakes?

@mike With some luck and a lot of examples I guess :D

I mean, I'm aware of the basic concepts of Rust even when this is mainly from a theoretical perspective, thought it's a nice idea to start something more practical ^^

And actually it worked quite well, until I tried to no longer print stuff directly but collecting it into one big string before printing it.

I'll going forward with this tonight, seems like I didn't paid enough attention to the mut-statement.

Sign in to participate in the conversation
Sheogorath's Microblog

This instance is the microblog to my blog. You'll probably find more recent content here while finding more elaborated content on the blog. Impressum / Datenschutz / Privacy