ViewableSequence¶
- class zixy.container.base.ViewableSequence[source]¶
Bases:
ViewableBase[ImplT,slice],Generic[T,ImplT],Sequence[T]Abstract base class for sequences with an ownership model and underlying Rust-bound data.
- __getitem__(indexer: int | slice) T | Self[source]¶
- Overloads:
self, indexer (int) → T
self, indexer (builtins.slice) → Self
Get the element or elements selected by
indexer.- Parameters:
indexer – Index or slice selecting the element(s) to return.
- Returns:
Element or slice selected by
indexer.
- as_view() Self[source]¶
Return a view of
self.- Returns:
If
selfis owning, a new view on the same underlying data, otherwiseself.
- count(value) integer -- return number of occurrences of value¶
- classmethod from_size(n: int) Self[source]¶
Create a new instance of
clswith the given size.- Parameters:
n – The size of the new instance.
- Returns:
An instance of
clswith the given size.
- classmethod from_view(source: Self) Self[source]¶
Create a new instance of
clsfrom a view.- Parameters:
source – View to clone into the new instance.
- Returns:
An owning clone of
source.
- into(t: type[OutT]) OutT¶
Clone
selfinto a new related container of typet.- Parameters:
t – Type of the new container to create.
- Returns:
A new instance of
tcontaining the same data asself.
- map_index(i: int) int[source]¶
Map an index in
selfto an index in the underlying data.- Parameters:
i – Index in
self.- Returns:
Corresponding index in the underlying data.
- resize(n: int) Self[source]¶
Resize the underlying container.
- Parameters:
n – The new size of the container.
Note
This method operates in-place.
- Raises:
ValueError – If the container is a view.