How is this possible??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How is this possible???

It says this is a rust code?? But how is it possible?? There is no place to write rust code in SoloLearn? https://code.sololearn.com/c1x1TRMqIuLS/?ref=app

1st Feb 2021, 12:52 PM
K.S.S. Karunarathne
K.S.S. Karunarathne - avatar
3 Answers
+ 2
Aaron Eberhardt but then how is the playground on the app able to accurately lint the code? Isn't the linter for each language built into the app?
1st Feb 2021, 7:35 PM
XXX
XXX - avatar
+ 1
This code uses a cheap trick to set an alternative language name for the code but obviously Sololearn has no Rust compiler installed yet. I think it works by manipulating requests on the web version of Sololearn which allow codes of any language (but it doesn't compile then). Yet it is actually possible to use Rust here through the rust-playground API in web codes. For example in this code you can simply use the CSS tab to write Rust code: https://code.sololearn.com/WvkacurP3cVK/?ref=app
1st Feb 2021, 6:20 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 1
XXX I guess they use a general purpose library for highlighting the code on the app and just simply pass the language of the code to it. At least it wouldn't make sense to remove the languages not supported by Sololearn from the library.
1st Feb 2021, 8:39 PM
Aaron Eberhardt
Aaron Eberhardt - avatar