linksplatform / doublets-rs

The Unlicense
5 stars 2 forks source link

Inline initiative #8

Open uselessgoddess opened 2 years ago

uselessgoddess commented 2 years ago

Add #[inline] attribute to relevant places

#[inline] – any obvious functions:

fn try_get_link(&self, index: T) -> Result<Link<T>, Error<T>> {
    self.get_link(index).ok_or(Error::NotExists(index))
}

#[inline(always)] – any hard delegations:

pub fn len(&self) -> usize {
    self.0.len()
}

#[cfg_attr(feature = "inline-more", inline)] – some questionable or rarely used or internal functions:

// from united/store.rs:194
fn is_unused(&self, link: T) -> bool {
   // impl . . . 
}