Struct rustpython_vm::function::ArgIterable
source · pub struct ArgIterable<T = PyObjectRef> { /* private fields */ }
Expand description
An iterable Python object.
ArgIterable
implements FromArgs
so that a built-in function can accept
an object that is required to conform to the Python iterator protocol.
ArgIterable can optionally perform type checking and conversions on iterated
objects using a generic type parameter that implements TryFromObject
.
Implementations§
source§impl<T> ArgIterable<T>
impl<T> ArgIterable<T>
sourcepub fn iter<'a>(&self, vm: &'a VirtualMachine) -> PyResult<PyIterIter<'a, T>>
pub fn iter<'a>(&self, vm: &'a VirtualMachine) -> PyResult<PyIterIter<'a, T>>
Returns an iterator over this sequence of objects.
This operation may fail if an exception is raised while invoking the
__iter__
method of the iterable object.
Trait Implementations§
source§impl<T: Traverse> Traverse for ArgIterable<T>
impl<T: Traverse> Traverse for ArgIterable<T>
source§fn traverse(&self, tracer_fn: &mut TraverseFn<'_>)
fn traverse(&self, tracer_fn: &mut TraverseFn<'_>)
impl
traverse()
with caution! Following those guideline so traverse doesn’t cause memory error!: Read moresource§impl<T> TryFromObject for ArgIterable<T>where
T: TryFromObject,
impl<T> TryFromObject for ArgIterable<T>where T: TryFromObject,
source§fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self>
fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self>
Attempt to convert a Python object to a value of this type.
Auto Trait Implementations§
impl<T = PyObjectRef> !RefUnwindSafe for ArgIterable<T>
impl<T = PyObjectRef> !Send for ArgIterable<T>
impl<T = PyObjectRef> !Sync for ArgIterable<T>
impl<T> Unpin for ArgIterable<T>where T: Unpin,
impl<T = PyObjectRef> !UnwindSafe for ArgIterable<T>
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
§impl<T, U> ExactFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> ExactFrom<T> for Uwhere U: TryFrom<T>,
fn exact_from(value: T) -> U
§impl<T, U> ExactInto<U> for Twhere
U: ExactFrom<T>,
impl<T, U> ExactInto<U> for Twhere U: ExactFrom<T>,
fn exact_into(self) -> U
source§impl<T> FromArgOptional for Twhere
T: TryFromObject,
impl<T> FromArgOptional for Twhere T: TryFromObject,
type Inner = T
fn from_inner(x: T) -> T
source§impl<T> FromArgs for Twhere
T: TryFromObject,
impl<T> FromArgs for Twhere T: TryFromObject,
source§fn arity() -> RangeInclusive<usize>
fn arity() -> RangeInclusive<usize>
The range of positional arguments permitted by the function signature. Read more
source§fn from_args(
vm: &VirtualMachine,
args: &mut FuncArgs
) -> Result<T, ArgumentError>
fn from_args( vm: &VirtualMachine, args: &mut FuncArgs ) -> Result<T, ArgumentError>
Extracts this item from the next argument(s).