[−][src]Struct rustpython_vm::function::PyFuncArgs
The PyFuncArgs
struct is one of the most used structs then creating
a rust function that can be called from python. It holds both positional
arguments, as well as keyword arguments passed to the function.
Fields
args: Vec<PyObjectRef>
kwargs: IndexMap<String, PyObjectRef>
Methods
impl PyFuncArgs
[src]
pub fn new(args: Vec<PyObjectRef>, kwarg_names: Vec<String>) -> PyFuncArgs
[src]
pub fn insert(&self, item: PyObjectRef) -> PyFuncArgs
[src]
pub fn shift(&mut self) -> PyObjectRef
[src]
pub fn get_kwarg(&self, key: &str, default: PyObjectRef) -> PyObjectRef
[src]
pub fn get_optional_kwarg(&self, key: &str) -> Option<PyObjectRef>
[src]
pub fn get_optional_kwarg_with_type(
&self,
key: &str,
ty: PyClassRef,
vm: &VirtualMachine
) -> PyResult<Option<PyObjectRef>>
[src]
&self,
key: &str,
ty: PyClassRef,
vm: &VirtualMachine
) -> PyResult<Option<PyObjectRef>>
pub fn take_positional(&mut self) -> Option<PyObjectRef>
[src]
pub fn take_positional_keyword(&mut self, name: &str) -> Option<PyObjectRef>
[src]
pub fn take_keyword(&mut self, name: &str) -> Option<PyObjectRef>
[src]
pub fn remaining_keywords<'a>(
&'a mut self
) -> impl Iterator<Item = (String, PyObjectRef)> + 'a
[src]
&'a mut self
) -> impl Iterator<Item = (String, PyObjectRef)> + 'a
pub fn bind<T: FromArgs>(self, vm: &VirtualMachine) -> PyResult<T>
[src]
Binds these arguments to their respective values.
If there is an insufficient number of arguments, there are leftover arguments after performing the binding, or if an argument is not of the expected type, a TypeError is raised.
If the given FromArgs
includes any conversions, exceptions raised
during the conversion will halt the binding and return the error.
Trait Implementations
impl Clone for PyFuncArgs
[src]
fn clone(&self) -> PyFuncArgs
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for PyFuncArgs
[src]
impl Default for PyFuncArgs
[src]
fn default() -> PyFuncArgs
[src]
impl<'_, '_> From<(&'_ Args<Rc<PyObject<dyn PyObjectPayload + 'static>>>, &'_ KwArgs<Rc<PyObject<dyn PyObjectPayload + 'static>>>)> for PyFuncArgs
[src]
impl From<Rc<PyObject<dyn PyObjectPayload + 'static>>> for PyFuncArgs
[src]
fn from(arg: PyObjectRef) -> Self
[src]
impl From<Vec<Rc<PyObject<dyn PyObjectPayload + 'static>>>> for PyFuncArgs
[src]
Conversion from vector of python objects to function arguments.
fn from(args: Vec<PyObjectRef>) -> Self
[src]
impl FromArgs for PyFuncArgs
[src]
fn from_args(
_vm: &VirtualMachine,
args: &mut PyFuncArgs
) -> Result<Self, ArgumentError>
[src]
_vm: &VirtualMachine,
args: &mut PyFuncArgs
) -> Result<Self, ArgumentError>
fn arity() -> RangeInclusive<usize>
[src]
impl<F> IntoPyNativeFunc<PyFuncArgs, Result<Rc<PyObject<dyn PyObjectPayload + 'static>>, PyRef<PyBaseException>>, VirtualMachine> for F where
F: Fn(&VirtualMachine, PyFuncArgs) -> PyResult + 'static,
[src]
F: Fn(&VirtualMachine, PyFuncArgs) -> PyResult + 'static,
fn into_func(self) -> PyNativeFunc
[src]
Auto Trait Implementations
impl !RefUnwindSafe for PyFuncArgs
impl !Send for PyFuncArgs
impl !Sync for PyFuncArgs
impl Unpin for PyFuncArgs
impl !UnwindSafe for PyFuncArgs
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> FromArgs for T where
T: TryFromObject,
[src]
T: TryFromObject,
fn arity() -> RangeInclusive<usize>
[src]
fn from_args(&VirtualMachine, &mut PyFuncArgs) -> Result<T, ArgumentError>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,