use core::borrow::BorrowMut;
use crate::dim::Const;
use crate::expr::{Apply, FromExpression};
use crate::shape::Shape;
use crate::slice::Slice;
pub trait IntoCloned<T> {
fn clone_to(self, target: &mut T);
fn into_cloned(self) -> T;
}
impl<T: Clone> IntoCloned<T> for &T {
#[inline]
fn clone_to(self, target: &mut T) {
target.clone_from(self);
}
#[inline]
fn into_cloned(self) -> T {
self.clone()
}
}
impl<T> IntoCloned<T> for T {
#[inline]
fn clone_to(self, target: &mut T) {
*target = self;
}
#[inline]
fn into_cloned(self) -> T {
self
}
}
pub trait Owned<T, S: Shape>: Apply<T> + BorrowMut<Slice<T, S>> + FromExpression<T, S> {
#[doc(hidden)]
type WithConst<const N: usize>: Owned<T, S::Prepend<Const<N>>>;
#[doc(hidden)]
fn clone_from_slice(&mut self, slice: &Slice<T, S>)
where
T: Clone;
}