GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing rustpython.github.io — objstaticmethod.rs.html -- source 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 use super::objtype::PyClassRef; use crate::function::OptionalArg; use crate::pyobject::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue}; use crate::slots::SlotDescriptor; use crate::vm::VirtualMachine; #[pyclass(name = "staticmethod")] #[derive(Clone, Debug)] pub struct PyStaticMethod { pub callable: PyObjectRef, } pub type PyStaticMethodRef = PyRef<PyStaticMethod>; impl PyValue for PyStaticMethod { fn class(vm: &VirtualMachine) -> PyClassRef { vm.ctx.staticmethod_type() } } impl SlotDescriptor for PyStaticMethod { fn descr_get( vm: &VirtualMachine, zelf: PyObjectRef, _obj: Option<PyObjectRef>, _cls: OptionalArg<PyObjectRef>, ) -> PyResult { let zelf = Self::_zelf(zelf, vm)?; Ok(zelf.callable.clone()) } } #[pyimpl(with(SlotDescriptor), flags(BASETYPE))] impl PyStaticMethod { #[pyslot] fn tp_new( cls: PyClassRef, callable: PyObjectRef, vm: &VirtualMachine, ) -> PyResult<PyStaticMethodRef> { PyStaticMethod { callable: callable.clone(), } .into_ref_with_type(vm, cls) } } pub fn init(context: &PyContext) { PyStaticMethod::extend_class(context, &context.types.staticmethod_type); } |
| 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. |