pub struct SaturatedSlice { /* private fields */ }
Expand description
A saturated slice with values ranging in [isize::MIN, isize::MAX]. Used for sliceable sequences that require indices in the aforementioned range.
Invokes __index__
on the PySliceRef during construction so as to separate the
transformation from PyObject into isize and the adjusting of the slice to a given
sequence length. The reason this is important is due to the fact that an objects
__index__
might get a lock on the sequence and cause a deadlock.
Implementations§
Source§impl SaturatedSlice
impl SaturatedSlice
pub fn with_slice(slice: &PySlice, vm: &VirtualMachine) -> PyResult<Self>
Sourcepub fn adjust_indices(&self, len: usize) -> (Range<usize>, isize, usize)
pub fn adjust_indices(&self, len: usize) -> (Range<usize>, isize, usize)
Convert for usage in indexing the underlying rust collections. Called after index has been called on the Slice which might mutate the collection.
pub fn iter(&self, len: usize) -> SaturatedSliceIter ⓘ
Trait Implementations§
Source§impl Clone for SaturatedSlice
impl Clone for SaturatedSlice
Source§fn clone(&self) -> SaturatedSlice
fn clone(&self) -> SaturatedSlice
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SaturatedSlice
impl Debug for SaturatedSlice
impl Copy for SaturatedSlice
Auto Trait Implementations§
impl Freeze for SaturatedSlice
impl RefUnwindSafe for SaturatedSlice
impl Send for SaturatedSlice
impl Sync for SaturatedSlice
impl Unpin for SaturatedSlice
impl UnwindSafe for SaturatedSlice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more