From 92f21d7f299c71a8cd7848cbec92df34fb92fe56 Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Thu, 19 Oct 2023 10:13:21 +0100 Subject: [PATCH] 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 X-Clacks-Overhead: GNU Terry Pratchett --- radicle-node/src/bounded.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/radicle-node/src/bounded.rs b/radicle-node/src/bounded.rs index 3fc1b39e..aea59730 100644 --- a/radicle-node/src/bounded.rs +++ b/radicle-node/src/bounded.rs @@ -189,6 +189,12 @@ impl TryFrom> for BoundedVec { } } +impl From> for Vec { + fn from(value: BoundedVec) -> Self { + value.v + } +} + impl std::fmt::Debug for BoundedVec { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { self.v.fmt(f)