Skip to content

Commit

Permalink
Merge pull request #3 from meh/from
Browse files Browse the repository at this point in the history
Add From implementations.
  • Loading branch information
huonw committed Aug 10, 2015
2 parents 438aa71 + 24b75f8 commit 4f07c0d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@ impl<'a,T> Strided for MutStride<'a,T> {
impl<'a,T> MutStrided for MutStride<'a,T> {
fn as_stride_mut(&mut self) -> MutStride<T> { self.reborrow() }
}

impl<'a,T, X: AsRef<[T]> + ?Sized> From<&'a X> for Stride<'a,T> {
fn from(value: &X) -> Stride<T> { Stride::new(value.as_ref()) }
}
impl<'a,T, X: AsMut<[T]> + ?Sized> From<&'a mut X> for MutStride<'a,T> {
fn from(value: &mut X) -> MutStride<T> { MutStride::new(value.as_mut()) }
}

0 comments on commit 4f07c0d

Please sign in to comment.