当前位置:网站首页>A few suggestions for making rust library more beautiful! Have you learned?

A few suggestions for making rust library more beautiful! Have you learned?

2022-07-06 23:09:00 InfoQ

Carl M. Kadie Like to create software libraries . Two months ago, a  Python  Package migration to  Rust crate  in . This new  Rust crate  And  Python  The ease of use and expressiveness of the package match . In practice , He learned nine rules , Can help you in  Rust  Create beautiful libraries in . The rule is :
1. Create concise examples
2. Improve function parameters so that they can accept more types
3. Understand your users' needs , Know what users want
4. Using the builder (builder)  To make it configurable
5. Writing a good document makes your design more sincere
6. Definition  From  To receive common types
7. To write API test
8. Define and return meaningful errors
9. Use Clippy
under these circumstances , Libraries are used by other programs  Rust crate. Library  API It is a group of public functions and objects that a program can call . Functionality  API  Just let users do everything they need to do ; And beautiful  API  Let them accomplish what they need to do in a simple and wise way .
At this stage , Nonconvex technology is based on Rust Ecology creates high efficiency 、 Low latency 、 Highly reliable full memory high frequency trading platform , Continue to work for securities companies 、 Quantitative private placement and many other large financial institutions provide high-quality algorithm Services . As Rust Quantitative forerunner , Try to promote Rust Language , Encourage more people to learn to communicate .

原网站

版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207061532511291.html