-
Notifications
You must be signed in to change notification settings - Fork 3
Rust integration #4
Comments
You don't have to generate them in the first implementation. Provide implementation only.
Do the code) I will integrate it with CMake.
Each single .rs file should know nothing about other file implementations at all. Each .rs must be written as if it is the only one .rs file in this project and the other files are written in C. |
Ah. I see. I don't think it is possible to implement C++ struct in Rust, but C structs only. There is a possibility to integrate Rust only if .h are generated (to keep ABI). So it should look something like:
In that case some parts of the code may be implemented either in C or in Rust. And in the future all C code will move to Rust. But... The only way to communicate between Rust and C would be C functions. That means that you can not use Rust/C++ power inside C code. Today my aim is to rewrite old C code into a safer C++ to make the code maintainable and testable. I try to keep the same API to run regression tests to find out whether my code works as it was expected in old toxcore. You may use my unit tests to do the same: you write only a Rust version, generate .h, link with my tests and you are done!
|
This look makes Rust code filled with |
You are right, a lot of |
@quininer You may reduce the number of |
For a rust implementation, you can have just unsafe rust – C adapter module, and leave everything else safe. Btw, we need C bindings for a rust implementation anyway. |
@suhr 👍 |
@kpp You've got some nice tests here, and I've picked applicable ones in what I did so far: https://github.com/zetok/tox + I've added a few other tests. Sorry if I got your hopes up about writing C/C++/Rust kind of monstrosity, sadly, this would be a bit too far beyond what I'm capable of doing :( What I plan on doing in my Rust implementation, is having ~pure Rust, Rust API + ~old C toxcore API for compatibility (unless they can be combined? I doubt whether that would be a good idea). C API probably will be limited to 1 file/module, as @suhr said. |
Whether there is a chat where it was possible to talk about development of the project? Skype/irc? |
@ud1 #2tox on Freenode |
#2tox: Cannot join channel (+i) - you must be invited |
@ud1 try again |
Consider using https://gitter.im/ as a dev chat. It integrates well with gh. |
Oh, and there's some thing I think I should do. |
As I understand it the purpose of this project is to write an implementation of the tox protocol with better documentation and higher code quality. If so then rust is probably a good language for this. But you're putting the cart before the horses. Instead of trying to write an implementation of something that is so poorly understood (the tox protocol) you should instead try to write a specification first. Once the protocol is properly described, writing an implementation will be the easy part. As far as I can tell, the documentation of the tox protocol is not much better now than it was in April 2014 and gentoo is probably never going to improve it. So the step forward is to either
Number 2 will be much harder of course but guarantees compatibility with clients using the toxcore library. In any case, I'm not quite sure why I was even pinged. |
@kpp thanks for the invitation to gitter, but.. no thanks. Given that it's a proprietary service, using it is a waste of time, and furthermore, loss of data. I think that you might be interested in reading https://www.mattermost.org/why-we-made-mattermost-an-open-source-slack-alternative/ which quite well shows that on an example. Quote of the ~most relevant part, even though whole article is worthy reading:
In other words, please don't fall in the trap, and if you could, please don't force other people to fall in it. |
@zetok You are dramatizing. Issues are hosted by github, CI by Travis, coverage by Coveralls. Alright, I may lose some data but who said chat messages is the data I care about? |
Chat messages most of time contain very useful ideas and are one of most important sources of knowledge about the project. E.g. what won't work, or what didn't work in the past. That basically makes them most important data, aside from the code itself. And since code is being mirrored by lots of people anyway.. You might want to organize that knowledge into FAQs and wiki pages, but even with massive amount of work in that direction it still won't cover all things that you chat about. |
There're bots for gitter, so you can sync it with IRC and save logs. |
I've looked into it a bit.
As for requirements;
There is rusty-cheddar for generating
.h
files from Rust files at "build" time. No idea about not including local Rust modules..?The real problem is integration with CMake. I see no point in me spending time one learning CMake just for this, and I don't see for what other reason I could ever want to learn it.
With that in mind, there's a link to something I found that probably(?) would be helpful to someone who could want to do it: https://stackoverflow.com/questions/31162438/how-can-i-build-rust-code-with-a-c-qt-cmake-project
I guess that I could try to write some code, but I don't think that there would be any point to it, given that it wouldn't be integrated with the rest of the codebase.
The text was updated successfully, but these errors were encountered: