Skip to content

Commit

Permalink
deprecated list-trait
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetbout committed Aug 5, 2024
1 parent e695ad5 commit 9b110d4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/storage/src/list.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use core::ops::index::IndexView;
use core::poseidon::poseidon_hash_span;
use core::traits::DivRem;
use starknet::storage_access::{
Expand All @@ -14,6 +15,9 @@ pub struct List<T> {
len: u32, // number of elements in array
}

#[deprecated(
feature: "deprecated-list-trait", note: "Use `starknet::storage::Vec`.", since: "2.7.0"
)]
pub trait ListTrait<T> {
/// Instantiates a new List with the given base address.
///
Expand Down Expand Up @@ -272,7 +276,9 @@ impl ListImpl<T, +Copy<T>, +Drop<T>, +Store<T>> of ListTrait<T> {
}
}

impl AListIndexViewImpl<T, +Copy<T>, +Drop<T>, +Store<T>> of IndexView<List<T>, u32, T> {
impl AListIndexViewImpl<T, +Copy<T>, +Drop<T>, +Store<T>> of IndexView<List<T>, u32> {
type Target = T;

fn index(self: @List<T>, index: u32) -> T {
self.get(index).expect('read syscall failed').expect('List index out of bounds')
}
Expand Down

0 comments on commit 9b110d4

Please sign in to comment.