[][src]Trait rustpython_vm::pyobject::ItemProtocol

pub trait ItemProtocol {
    fn get_item<T: IntoPyObject + DictKey + Copy>(
        &self,
        key: T,
        vm: &VirtualMachine
    ) -> PyResult;
fn set_item<T: IntoPyObject + DictKey + Copy>(
        &self,
        key: T,
        value: PyObjectRef,
        vm: &VirtualMachine
    ) -> PyResult;
fn del_item<T: IntoPyObject + DictKey + Copy>(
        &self,
        key: T,
        vm: &VirtualMachine
    ) -> PyResult; }

The python item protocol. Mostly applies to dictionaries. Allows getting, setting and deletion of keys-value pairs.

Required methods

fn get_item<T: IntoPyObject + DictKey + Copy>(
    &self,
    key: T,
    vm: &VirtualMachine
) -> PyResult

fn set_item<T: IntoPyObject + DictKey + Copy>(
    &self,
    key: T,
    value: PyObjectRef,
    vm: &VirtualMachine
) -> PyResult

fn del_item<T: IntoPyObject + DictKey + Copy>(
    &self,
    key: T,
    vm: &VirtualMachine
) -> PyResult

Loading content...

Implementors

impl ItemProtocol for PyDictRef[src]

impl ItemProtocol for PyObjectRef[src]

Loading content...