Malanche / escpos-rs

Control esc/pos printers through rust.
MIT License
15 stars 5 forks source link

Fix failing documentation tests #3

Closed DusterTheFirst closed 2 years ago

DusterTheFirst commented 2 years ago

This is a separate PR from the other since it in essence is a different change. By seperating the changes into multiple PRs you can individually accept one or the other or both. The rustdoc documentation is a good place to look for information on doctests. (https://doc.rust-lang.org/rustdoc/documentation-tests.html).

I would suggest setting up running these tests (run whenever you run cargo test) on GitHub Actions or some other CI service so that it is sure to be run on all of your code when you make changes

DusterTheFirst commented 2 years ago

Another side note, as of the newest version of rust, you can include your readme as your crate level documentation rather than having to write and maintain docs in the readme and in thhe crate documentation comment. Here is the release, the first bullet under language is the change I am talking about: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1540-2021-07-29

I was going to create another PR with this change, but the docs in the readme and main doc comment both have different information and I think it would be better to just bring this up with you so that you can decide if it would be worth it or how to merge the docs from the doc comment and the readme.

Malanche commented 2 years ago

I might keep them slightly different but I will be careful that they are both correct in terms of examples and syntax. The library suffered quite big changes that I did not reflect in the examples (got too excited about publishing the project)... I didn't know the examples could run even if there was no "main" function (I thought these would just be ignored). I merged your branch and published to crates.io since the library seems to trigger a bug in docs.rs, it is not generating the docs. I thought it had to do with these examples panicking but the docs are still not there.