Functions and methods

Prefer methods to functions if there is a clear receiver. [FIXME: needs RFC]

Prefer

fn main() { impl Foo { pub fn frob(&self, w: widget) { ... } } }
impl Foo {
    pub fn frob(&self, w: widget) { ... }
}

over

fn main() { pub fn frob(foo: &Foo, w: widget) { ... } }
pub fn frob(foo: &Foo, w: widget) { ... }

for any operation that is clearly associated with a particular type.

Methods have numerous advantages over functions:

[FIXME] Revisit these guidelines with UFCS and conventions developing around it.

Guidelines for inherent methods. [FIXME]

[FIXME] We need guidelines for when to provide inherent methods on a type, versus methods through a trait or functions.

NOTE: Rules for method resolution around inherent methods are in flux, which may impact the guidelines.