Struct pyo3::PySlice [−][src]
pub struct PySlice(_);
Represents a Python slice
.
Only c_long
indeces supprted at the moment by PySlice
object.
Methods
impl PySlice
[src]
impl PySlice
pub fn new(py: Python, start: isize, stop: isize, step: isize) -> &PySlice
[src]
pub fn new(py: Python, start: isize, stop: isize, step: isize) -> &PySlice
Construct a new slice with the given elements.
pub fn indices(&self, length: c_long) -> PyResult<PySliceIndices>
[src]
pub fn indices(&self, length: c_long) -> PyResult<PySliceIndices>
Retrieve the start, stop, and step indices from the slice object slice assuming a sequence of length length, and store the length of the slice in slicelength.
Trait Implementations
impl<'a> From<&'a PySlice> for &'a PyObjectRef
[src]
impl<'a> From<&'a PySlice> for &'a PyObjectRef
impl AsRef<PyObjectRef> for PySlice
[src]
impl AsRef<PyObjectRef> for PySlice
fn as_ref(&self) -> &PyObjectRef
[src]
fn as_ref(&self) -> &PyObjectRef
Performs the conversion.
impl PyObjectWithToken for PySlice
[src]
impl PyObjectWithToken for PySlice
impl ToPyPointer for PySlice
[src]
impl ToPyPointer for PySlice
impl PartialEq for PySlice
[src]
impl PartialEq for PySlice
fn eq(&self, o: &PySlice) -> bool
[src]
fn eq(&self, o: &PySlice) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PyTypeInfo for PySlice
[src]
impl PyTypeInfo for PySlice
type Type = ()
Type of objects to store in PyObject struct
type BaseType = PyObjectRef
Base class
const NAME: &'static str
NAME: &'static str = "PySlice"
Class name
const SIZE: usize
SIZE: usize = ::std::mem::size_of::<::ffi::PyObject>()
Size of the rust PyObject structure (PyObject + rust structure)
const OFFSET: isize
OFFSET: isize = 0
Type
instance offset inside PyObject structure
unsafe fn type_object() -> &'static mut PyTypeObject
[src]
unsafe fn type_object() -> &'static mut PyTypeObject
PyTypeObject instance for this type
fn is_instance(ptr: *mut PyObject) -> bool
[src]
fn is_instance(ptr: *mut PyObject) -> bool
Check if *mut ffi::PyObject
is instance of this type
const DESCRIPTION: &'static str
DESCRIPTION: &'static str = "\u{0}"
Class doc string
const FLAGS: usize
FLAGS: usize = 0
Type flags (ie PY_TYPE_FLAG_GC, PY_TYPE_FLAG_WEAKREF)
fn is_exact_instance(ptr: *mut PyObject) -> bool
[src]
fn is_exact_instance(ptr: *mut PyObject) -> bool
Check if *mut ffi::PyObject
is exact instance of this type
impl PyTypeObject for PySlice
[src]
impl PyTypeObject for PySlice
fn init_type()
[src]
fn init_type()
Initialize type object
fn type_object() -> Py<PyType>
[src]
fn type_object() -> Py<PyType>
Retrieves the type object for this Python object type.
fn create(py: Python) -> PyResult<PyRawObject> where
Self: Sized + PyObjectAlloc<Self> + PyTypeInfo,
[src]
fn create(py: Python) -> PyResult<PyRawObject> where
Self: Sized + PyObjectAlloc<Self> + PyTypeInfo,
Create PyRawObject which can be initialized with rust value
impl ToPyObject for PySlice
[src]
impl ToPyObject for PySlice
impl ToBorrowedObject for PySlice
[src]
impl ToBorrowedObject for PySlice
fn with_borrowed_ptr<F, R>(&self, _py: Python, f: F) -> R where
F: FnOnce(*mut PyObject) -> R,
[src]
fn with_borrowed_ptr<F, R>(&self, _py: Python, f: F) -> R where
F: FnOnce(*mut PyObject) -> R,
Converts self into a Python object and calls the specified closure on the native FFI pointer underlying the Python object. Read more
impl Debug for PySlice
[src]
impl Debug for PySlice
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Display for PySlice
[src]
impl Display for PySlice
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<'a> FromPyObject<'a> for &'a PySlice
[src]
impl<'a> FromPyObject<'a> for &'a PySlice
fn extract(ob: &'a PyObjectRef) -> PyResult<Self>
[src]
fn extract(ob: &'a PyObjectRef) -> PyResult<Self>
Extracts Self
from the source PyObject
.