The Trait Zoo - AsRef

TL;DR

References of it can be treated as references of another type (with low conversion overhead).

Requirements

?Sized

Definition

➶
  • fn as_ref(&self) -> &T;

Implementation template

impl AsRef<[u8]> for str {
    fn as_ref(&self) -> &[u8] {
        self.as_bytes()
    }
}
©2022 - 🦀 - PRs welcome here - Haskell version - Zoo icons created by iconixar - Flaticon - Title font by Reka - Dafont