GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • rustpython_vm
  • function

This view

  • Original page
  • New address

GeezerVison is showing rustpython.github.io — rustpython_vm::function::PyFuncArgs - Rust

[−][src]Struct rustpython_vm::function::PyFuncArgs

pub struct PyFuncArgs {
    pub args: Vec<PyObjectRef>,
    pub kwargs: IndexMap<String, PyObjectRef>,
}

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]

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]

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]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for PyFuncArgs[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for PyFuncArgs[src]

fn default() -> PyFuncArgs[src]

Returns the "default value" for a type. Read more

impl<'_, '_> From<(&'_ Args<Rc<PyObject<dyn PyObjectPayload + 'static>>>, &'_ KwArgs<Rc<PyObject<dyn PyObjectPayload + 'static>>>)> for PyFuncArgs[src]

fn from(arg: (&Args, &KwArgs)) -> Self[src]

Performs the conversion.

impl From<Rc<PyObject<dyn PyObjectPayload + 'static>>> for PyFuncArgs[src]

fn from(arg: PyObjectRef) -> Self[src]

Performs the conversion.

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]

Performs the conversion.

impl FromArgs for PyFuncArgs[src]

fn from_args(
    _vm: &VirtualMachine,
    args: &mut PyFuncArgs
) -> Result<Self, ArgumentError>
[src]

Extracts this item from the next argument(s).

fn arity() -> RangeInclusive<usize>[src]

The range of positional arguments permitted by the function signature. Read more

impl<F> IntoPyNativeFunc<PyFuncArgs, Result<Rc<PyObject<dyn PyObjectPayload + 'static>>, PyRef<PyBaseException>>, VirtualMachine> for F where
    F: Fn(&VirtualMachine, PyFuncArgs) -> PyResult + 'static, 
[src]

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]

fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

fn from(t: T) -> T[src]

Performs the conversion.

impl<T> FromArgs for T where
    T: TryFromObject, 
[src]

fn arity() -> RangeInclusive<usize>[src]

The range of positional arguments permitted by the function signature. Read more

fn from_args(&VirtualMachine, &mut PyFuncArgs) -> Result<T, ArgumentError>[src]

Extracts this item from the next argument(s).

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

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]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

fn vzip(self) -> V

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.