Skip to content

Commit cfc9b33

Browse files
committed
Update docs on conversion trait impls.
1 parent e7a02ed commit cfc9b33

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/vec/mod.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,9 +1219,16 @@ impl<T, S: VecStorage<T> + ?Sized> Drop for VecInner<T, S> {
12191219
}
12201220

12211221
#[cfg(feature = "alloc")]
1222-
impl<'a, T, const N: usize> TryFrom<alloc::vec::Vec<T>> for Vec<T, N> {
1222+
/// Converts the given `alloc::vec::Vec<T>` into a `Vec<T, N>`.
1223+
impl<T, const N: usize> TryFrom<alloc::vec::Vec<T>> for Vec<T, N> {
12231224
type Error = ();
12241225

1226+
/// Converts the given `alloc::vec::Vec<T>` into a `Vec<T, N>`.
1227+
///
1228+
/// # Errors
1229+
///
1230+
/// Returns `Err` if the length of the `alloc::vec::Vec<T>` is greater than `N`.
1231+
///
12251232
fn try_from(alloc_vec: alloc::vec::Vec<T>) -> Result<Self, Self::Error> {
12261233
let mut vec = Vec::new();
12271234

@@ -1234,7 +1241,9 @@ impl<'a, T, const N: usize> TryFrom<alloc::vec::Vec<T>> for Vec<T, N> {
12341241
}
12351242

12361243
#[cfg(feature = "alloc")]
1237-
impl<'a, T, const N: usize> From<Vec<T, N>> for alloc::vec::Vec<T> {
1244+
/// Converts the given `Vec<T, N>` into an `alloc::vec::Vec<T>`.
1245+
impl<T, const N: usize> From<Vec<T, N>> for alloc::vec::Vec<T> {
1246+
/// Converts the given `Vec<T, N>` into an `alloc::vec::Vec<T>`.
12381247
fn from(vec: Vec<T, N>) -> Self {
12391248
alloc::vec::Vec::from_iter(vec.into_iter())
12401249
}

0 commit comments

Comments
 (0)