# StorageVec to Vec or function parameter?

**URL:** <https://forum.fuel.network/t/storagevec-to-vec-or-function-parameter/2437>\
**Category:** Sway\
**Created:** [April 24, 2023, 8:47am UTC](https://forum.fuel.network/t/storagevec-to-vec-or-function-parameter/2437 "2023-04-24T08:47:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maurice](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@maurice](https://forum.fuel.network/u/maurice)\
**Post date:** [April 24, 2023, 8:47am UTC](https://forum.fuel.network/t/storagevec-to-vec-or-function-parameter/2437/1 "2023-04-24T08:47:28Z")

</div>

Hey guys, hope you’re doing fine.  
Is there any way to either 1) convert a StorageVec to a Vec or 2) directly hand over a StorageVec to a function which should not have storage access. 2) seems a bit counter intuitive, so I hoped I could somehow convert it to a Vec, cannot find any docs about it and a simple code assignment returns an error.

The motivation behind this question is that I just don’t want all my functions to live inside my contract but still need to keep track of the vector in storage.  
Thanks!

---

<div class="post-metadata">

**Author:** ![IGI-111](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/igi-111/32/1348_2.png) [@IGI-111](https://forum.fuel.network/u/IGI-111)\
**Post date:** [April 24, 2023, 12:17pm UTC](https://forum.fuel.network/t/storagevec-to-vec-or-function-parameter/2437/2 "2023-04-24T12:17:13Z")

</div>

The allocation models and the significance of using those types are quite different so I don’t think it would make much sense to automagically convert one to the other.

This sounds like an issue which would be best solved using and/or passing around iterators, which we don’t have yet.

That said, as it stands you can probably simply loop through your StorageVec to copy it to a Vec, manipulate it as such, and then copy it back. That is if you don’t mind the runtime cost.

---

<div class="post-metadata">

**Author:** ![maurice](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@maurice](https://forum.fuel.network/u/maurice)\
**Post date:** [April 24, 2023, 2:30pm UTC](https://forum.fuel.network/t/storagevec-to-vec-or-function-parameter/2437/3 "2023-04-24T14:30:56Z")

</div>

Thank you for the answer, this is exactly what I resorted to for now. Let me add that Braqzen suggested to take a look at Storage Slice ([Discord](https://discord.com/channels/732892373507375164/734213700835082330/1099995647597359175)), so there might be a better solution out there, I’ll try soon.
