Naming Conventions

Rust

Retrieval Functions

The prefix determines what is being returned.

  • get*() -> T or get*() -> Result<T>
  • Return a non-Option object, usually wrapped in a Result<T>
  • Example: get_by_names()
  • find*() -> Option<T> or find*() -> Result<Option<T>>
  • Returns a single optional object
  • search*() -> Vec<T> or search*() -> Result<Vec<T>>
  • Returns a list of objects
  • map*_by_*() -> HashMap<TKey, TValue> or map*_by_*() -> Result<HashMap>
  • Returns a mapping of some sort

In many cases, there is a _by_ which indicates how the item is found.

Metadata

Project