pyo3::types::slice

Struct PySliceIndices

Source
pub struct PySliceIndices {
    pub start: isize,
    pub stop: isize,
    pub step: isize,
    pub slicelength: usize,
}
Expand description

Return value from PySliceMethods::indices.

Fields§

§start: isize

Start of the slice

It can be -1 when the step is negative, otherwise it’s non-negative.

§stop: isize

End of the slice

It can be -1 when the step is negative, otherwise it’s non-negative.

§step: isize

Increment to use when iterating the slice from start to stop.

§slicelength: usize

The length of the slice calculated from the original input sequence.

Implementations§

Source§

impl PySliceIndices

Source

pub fn new(start: isize, stop: isize, step: isize) -> PySliceIndices

Creates a new PySliceIndices.

Trait Implementations§

Source§

impl Debug for PySliceIndices

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for PySliceIndices

Source§

#[doc(hidden)] fn assert_receiver_is_total_eq(&self)

Source§

impl<'py> IntoPyObject<'py> for &PySliceIndices

Source§

type Target = PySlice

The Python output type
Source§

type Output = Bound<'py, <&PySliceIndices as IntoPyObject<'py>>::Target>

The smart pointer type to use. Read more
Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error>

Performs the conversion.
Source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
Extracts the type hint information for this type when it appears as a return value. Read more
Source§

#[doc(hidden)] fn owned_sequence_into_pyobject<I>( iter: I, py: Python<'py>, _: Token, ) -> Result<Bound<'py, PyAny>, PyErr>
where I: IntoIterator<Item = Self> + AsRef<[Self]>, I::IntoIter: ExactSizeIterator<Item = Self>,

Converts sequence of Self into a Python object. Used to specialize Vec<u8>, [u8; N] and SmallVec<[u8; N]> as a sequence of bytes into a bytes object.
Source§

#[doc(hidden)] fn borrowed_sequence_into_pyobject<I>( iter: I, py: Python<'py>, _: Token, ) -> Result<Bound<'py, PyAny>, PyErr>
where Self: Reference, I: IntoIterator<Item = Self> + AsRef<[<Self as Reference>::BaseType]>, I::IntoIter: ExactSizeIterator<Item = Self>,

Converts sequence of Self into a Python object. Used to specialize &[u8] and Cow<[u8]> as a sequence of bytes into a bytes object.
Source§

impl<'py> IntoPyObject<'py> for PySliceIndices

Source§

type Target = PySlice

The Python output type
Source§

type Output = Bound<'py, <PySliceIndices as IntoPyObject<'py>>::Target>

The smart pointer type to use. Read more
Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error>

Performs the conversion.
Source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
Extracts the type hint information for this type when it appears as a return value. Read more
Source§

#[doc(hidden)] fn owned_sequence_into_pyobject<I>( iter: I, py: Python<'py>, _: Token, ) -> Result<Bound<'py, PyAny>, PyErr>
where I: IntoIterator<Item = Self> + AsRef<[Self]>, I::IntoIter: ExactSizeIterator<Item = Self>,

Converts sequence of Self into a Python object. Used to specialize Vec<u8>, [u8; N] and SmallVec<[u8; N]> as a sequence of bytes into a bytes object.
Source§

impl PartialEq for PySliceIndices

Source§

fn eq(&self, other: &PySliceIndices) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ToPyObject for PySliceIndices

Source§

fn to_object(&self, py: Python<'_>) -> PyObject

👎Deprecated since 0.23.0: ToPyObject is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Converts self into a Python object.
Source§

impl StructuralPartialEq for PySliceIndices

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AssertNotZeroSized for T

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<'py, T> IntoPyCallbackOutput<'py, *mut PyObject> for T
where T: IntoPyObject<'py>,

Source§

impl<'py, T> IntoPyCallbackOutput<'py, Py<PyAny>> for T
where T: IntoPyObject<'py>,

Source§

fn convert(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>

Source§

impl<'py, T> IntoPyObjectExt<'py> for T
where T: IntoPyObject<'py>,

Source§

fn into_bound_py_any(self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>>

Converts self into an owned Python object, dropping type information.
Source§

fn into_py_any(self, py: Python<'py>) -> PyResult<Py<PyAny>>

Converts self into an owned Python object, dropping type information and unbinding it from the 'py lifetime.
Source§

fn into_pyobject_or_pyerr(self, py: Python<'py>) -> PyResult<Self::Output>

Converts self into a Python object. Read more
Source§

impl<T> PyErrArguments for T
where T: for<'py> IntoPyObject<'py> + Send + Sync,

Source§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
Source§

impl<T> SizedTypeProperties for T

Source§

#[doc(hidden)] const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
Source§

#[doc(hidden)] const LAYOUT: Layout = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

impl<T> SomeWrap<T> for T

Source§

fn wrap(self) -> Option<T>

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> PyClassSync for T
where T: Sync,

Source§

impl<'py, T> Sealed for T
where T: IntoPyObject<'py>,

Source§

impl<T> Ungil for T
where T: Send,

⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here