| 273 #[inline] |
273 #[inline] |
| 274 fn into_owned(self) -> Self::OwnedVariant { |
274 fn into_owned(self) -> Self::OwnedVariant { |
| 275 Pair(self.0.into_owned(), self.1.into_owned()) |
275 Pair(self.0.into_owned(), self.1.into_owned()) |
| 276 } |
276 } |
| 277 |
277 |
| 278 /// Returns an owned instance of a reference. |
278 #[inline] |
| 279 fn clone_owned(&self) -> Self::OwnedVariant { |
279 fn clone_owned(&self) -> Self::OwnedVariant { |
| 280 Pair(self.0.clone_owned(), self.1.clone_owned()) |
280 Pair(self.0.clone_owned(), self.1.clone_owned()) |
| |
281 } |
| |
282 |
| |
283 #[inline] |
| |
284 fn cow_owned<'b>(self) -> MyCow<'b, Self::OwnedVariant> |
| |
285 where |
| |
286 Self: 'b, |
| |
287 { |
| |
288 MyCow::Owned(self.into_owned()) |
| 281 } |
289 } |
| 282 } |
290 } |
| 283 |
291 |
| 284 /// We only support 'closed' `Euclidean` `Pair`s, as more general ones cause |
292 /// We only support 'closed' `Euclidean` `Pair`s, as more general ones cause |
| 285 /// compiler overflows. |
293 /// compiler overflows. |
| 441 self.0 |
447 self.0 |
| 442 .eval_ref_decompose(|a| self.1.eval_ref_decompose(|b| f(Pair(a, b)))) |
448 .eval_ref_decompose(|a| self.1.eval_ref_decompose(|b| f(Pair(a, b)))) |
| 443 } |
449 } |
| 444 |
450 |
| 445 #[inline] |
451 #[inline] |
| 446 fn cow<'b>(self) -> MyCow<'b, Pair<D::OwnedInstance, Q::OwnedInstance>> |
452 fn cow<'b>(self) -> MyCow<'b, Pair<A::OwnedSpace, B::OwnedSpace>> |
| 447 where |
453 where |
| 448 Self: 'b, |
454 Self: 'b, |
| 449 { |
455 { |
| 450 MyCow::Owned(Pair(self.0.own(), self.1.own())) |
456 MyCow::Owned(Pair(self.0.own(), self.1.own())) |
| 451 } |
457 } |
| 452 |
458 |
| 453 #[inline] |
459 #[inline] |
| 454 fn own(self) -> Pair<D::OwnedInstance, Q::OwnedInstance> { |
460 fn own(self) -> Pair<A::OwnedSpace, B::OwnedSpace> { |
| 455 Pair(self.0.own(), self.1.own()) |
461 Pair(self.0.own(), self.1.own()) |
| 456 } |
462 } |
| 457 } |
463 } |
| 458 |
464 |
| 459 impl<'a, A, B, U, V, D, Q> Instance<Pair<A, B>, PairDecomposition<D, Q>> for &'a Pair<U, V> |
465 impl<'a, A, B, U, V, D, Q> Instance<Pair<A, B>, PairDecomposition<D, Q>> for &'a Pair<U, V> |
| 492 self.0 |
498 self.0 |
| 493 .eval_ref_decompose(|a| self.1.eval_ref_decompose(|b| f(Pair(a, b)))) |
499 .eval_ref_decompose(|a| self.1.eval_ref_decompose(|b| f(Pair(a, b)))) |
| 494 } |
500 } |
| 495 |
501 |
| 496 #[inline] |
502 #[inline] |
| 497 fn cow<'b>(self) -> MyCow<'b, Pair<D::OwnedInstance, Q::OwnedInstance>> |
503 fn cow<'b>(self) -> MyCow<'b, Pair<A::OwnedSpace, B::OwnedSpace>> |
| 498 where |
504 where |
| 499 Self: 'b, |
505 Self: 'b, |
| 500 { |
506 { |
| 501 MyCow::Owned(self.own()) |
507 MyCow::Owned(self.own()) |
| 502 } |
508 } |
| 503 |
509 |
| 504 #[inline] |
510 #[inline] |
| 505 fn own(self) -> Pair<D::OwnedInstance, Q::OwnedInstance> { |
511 fn own(self) -> Pair<A::OwnedSpace, B::OwnedSpace> { |
| 506 let Pair(ref u, ref v) = self; |
512 let Pair(ref u, ref v) = self; |
| 507 Pair(u.own(), v.own()) |
513 Pair(u.own(), v.own()) |
| 508 } |
514 } |
| 509 } |
515 } |
| 510 |
516 |