2017-02-20から1日間の記事一覧

`Deref` coercions

https://doc.rust-lang.org/book/deref-coercions.html *も型に合わせて定義できる。 use std::ops::Deref; struct DerefExample<T> { value: T, } impl<T> Deref for DerefExample<T> { type Target = T; fn deref(&self) -> &T { &self.value } } fn main() { let x</t></t></t>…