Mojo struct
StridedSlice
struct StridedSlice
Represents a slice expression that has a stride.
This type is used to support different behavior for strided vs unstrided slicing.
Implemented traits
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDestructible,
Movable,
Writable
Methods
__init__
@implicit
__init__(out self, other: Slice)
Implicitly convert from a general slice.
Args:
- other (
Slice): The other slice.
__init__(out self, start: Optional[Int], end: Optional[Int], stride: Int, __slice_literal__: Tuple[] = Tuple())
Construct slice given start, end, and stride values.
Args:
write_to
write_to(self, mut writer: T)
Write StridedSlice string representation to a Writer.
Args:
- writer (
T): The object to write to.
write_repr_to
write_repr_to(self, mut writer: T)
Write StridedSlice debug representation to a Writer.
Args:
- writer (
T): The object to write to.
indices
indices(self, length: Int) -> Tuple[Int, Int, Int]
Returns a tuple of 3 integers representing start, end, and step of the slice if applied to a container of given length.
Args:
- length (
Int): The length of the target container.
Returns:
Tuple: A tuple containing three integers for start, end, and step.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!