SpanTraitExt
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt
pub trait SpanTraitExt<T, +Clone<T>, +Drop<T>>
Trait functions
pop_front_n
Removes up to n elements from the front of self and returns them in a new span.
Arguments
self- The span to modifyn- The number of elements to remove from the front
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::pop_front_n
fn pop_front_n(ref self: Span<T>, n: u32) -> Span<T>
pop_back_n
Removes up to n elements from the back of self and returns them in a new span.
Arguments
self- The span to modifyn- The number of elements to remove from the back
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::pop_back_n
fn pop_back_n(ref self: Span<T>, n: u32) -> Span<T>
remove_front_n
Removes up to n elements from the front of self.
Arguments
self- The span to modifyn- The number of elements to remove from the front
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::remove_front_n
fn remove_front_n(ref self: Span<T>, n: u32)
remove_back_n
Removes up to n elements from the back of self.
Arguments
self- The span to modifyn- The number of elements to remove from the back
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::remove_back_n
fn remove_back_n(ref self: Span<T>, n: u32)
concat
Clones and appends all the elements of self and then other in a single new array.
Arguments
self- The first span to concatenateother- The second span to concatenate
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::concat
fn concat(self: Span<T>, other: Span<T>) -> Array<T>
reversed
Return a new array containing the elements of self in a reversed order.
Arguments
self- The span to reverse
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::reversed
fn reversed(self: Span<T>) -> Array<T>
contains
Returns true if the span contains an element with the given value.
Arguments
self- The span to searchitem- The value to search for
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::contains
fn contains<+PartialEq<T>>(self: Span<T>, item: @T) -> bool
position
Searches for an element the span, returning its index.
Arguments
self- The span to searchitem- The value to search for
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::position
fn position<+PartialEq<T>>(self: Span<T>, item: @T) -> Option<u32>
occurrences
Returns the number of elements in the span with the given value.
Arguments
self- The span to searchitem- The value to count
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::occurrences
fn occurrences<+PartialEq<T>>(self: Span<T>, item: @T) -> u32
min
Returns the minimum element of a span.
Arguments
self- The span to find the minimum value in
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::min
fn min<+PartialOrd<@T>>(self: Span<T>) -> Option<T>
min_position
Returns the position of the minimum element of a span.
Arguments
self- The span to find the minimum position in
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::min_position
fn min_position<+PartialOrd<@T>>(self: Span<T>) -> Option<u32>
max
Returns the maximum element of a span.
Arguments
self- The span to find the maximum value in
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::max
fn max<+PartialOrd<@T>>(self: Span<T>) -> Option<T>
max_position
Returns the position of the maximum element of a span.
Arguments
self- The span to find the maximum position in
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::max_position
fn max_position<+PartialOrd<@T>>(self: Span<T>) -> Option<u32>
dedup
Returns a new array, cloned from self but removes consecutive repeated elements.
If the span is sorted, this removes all duplicates.
Arguments
self- The span to deduplicate
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::dedup
fn dedup<+PartialEq<T>>(self: Span<T>) -> Array<T>
unique
Returns a new array, cloned from self but without any duplicate.
Arguments
self- The span to get unique elements from
Fully qualified path: alexandria_data_structures::span_ext::SpanTraitExt::unique
fn unique<+PartialEq<T>>(self: Span<T>) -> Array<T>