mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-28 21:50:26 +08:00
node: add conversion for BoundedVec to Vec
While there is a method, `unbound`, for converting a `BoundedVec` to its inner `Vec`, it is common practice to implement the `From` trait. Add the `From` conversion for `BoundedVec` and `Vec`. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
@@ -189,6 +189,12 @@ impl<T, const N: usize> TryFrom<Vec<T>> for BoundedVec<T, N> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, const N: usize> From<BoundedVec<T, N>> for Vec<T> {
|
||||
fn from(value: BoundedVec<T, N>) -> Self {
|
||||
value.v
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: std::fmt::Debug, const N: usize> std::fmt::Debug for BoundedVec<T, N> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
self.v.fmt(f)
|
||||
|
||||
Reference in New Issue
Block a user