Giter Club home page Giter Club logo

Comments (1)

newAM avatar newAM commented on July 21, 2024

API checklist

https://rust-lang.github.io/api-guidelines/checklist.html
https://raw.githubusercontent.com/rust-lang/api-guidelines/master/src/checklist.md

  • Naming (crate aligns with Rust naming conventions)
    • Casing conforms to RFC 430
    • Ad-hoc conversions follow as_, to_, into_ conventions
    • Getter names follow Rust convention
    • Methods on collections that produce iterators follow iter, iter_mut, into_iter
    • Iterator type names match the methods that produce them
    • Feature names are free of placeholder words
    • Names use a consistent word order
  • Interoperability (crate interacts nicely with other library functionality)
    • Types eagerly implement common traits
      • Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug,
        Display, Default
    • Conversions use the standard traits From, AsRef, AsMut
    • Collections implement FromIterator and Extend
    • Data structures implement Serde's Serialize, Deserialize
    • Types are Send and Sync where possible
    • Error types are meaningful and well-behaved
    • Binary number types provide Hex, Octal, Binary formatting
    • Generic reader/writer functions take R: Read and W: Write by value
  • Macros (crate presents well-behaved macros)
    • Input syntax is evocative of the output
    • Macros compose well with attributes
    • Item macros work anywhere that items are allowed
    • Item macros support visibility specifiers
    • Type fragments are flexible
  • Documentation (crate is abundantly documented)
    • Crate level docs are thorough and include examples
    • All items have a rustdoc example
    • Examples use ?, not try!, not unwrap
    • Function docs include error, panic, and safety considerations
    • Prose contains hyperlinks to relevant things
    • Cargo.toml includes all common metadata
      • authors, description, license, homepage, documentation, repository,
        keywords, categories
    • Release notes document all significant changes
    • Rustdoc does not show unhelpful implementation details
  • Predictability (crate enables legible code that acts how it looks)
    • Smart pointers do not add inherent methods
    • Conversions live on the most specific type involved
    • Functions with a clear receiver are methods
    • Functions do not take out-parameters
    • Operator overloads are unsurprising
    • Only smart pointers implement Deref and DerefMut
    • Constructors are static, inherent methods
  • Flexibility (crate supports diverse real-world use cases)
    • Functions expose intermediate results to avoid duplicate work
    • Caller decides where to copy and place data
    • Functions minimize assumptions about parameters by using generics
    • Traits are object-safe if they may be useful as a trait object
  • Type safety (crate leverages the type system effectively)
    • Newtypes provide static distinctions
    • Arguments convey meaning through types, not bool or Option
    • Types for a set of flags are bitflags, not enums
    • Builders enable construction of complex values
  • Dependability (crate is unlikely to do the wrong thing)
    • Functions validate their arguments
    • Destructors never fail
    • Destructors that may block have alternatives
  • Debuggability (crate is conducive to easy debugging)
    • All public types implement Debug
    • Debug representation is never empty
  • Future proofing (crate is free to improve without breaking users' code)
    • Sealed traits protect against downstream implementations
    • Structs have private fields
    • Newtypes encapsulate implementation details
    • Data structures do not duplicate derived trait bounds
  • Necessities (to whom they matter, they really matter)
    • Public dependencies of a stable crate are stable
    • Crate and its dependencies have a permissive license

from stm32wlxx-hal.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.