AsMapping::AS_MAPPING

This commit is contained in:
Jeong Yunwon committed 2022-05-28 01:42:06 +09:00
1 parent d05645ea58
commit 97c2d187f6
3 files changed
+17 -8

No files matched your search

Generated
+11 -2
View File
@@ -1518,7 +1518,7 @@ dependencies = [
"proc-macro2",
"quote",
"syn",
"syn-ext",
"syn-ext 0.3.1",
]
[[package]]
@@ -1645,7 +1645,7 @@ dependencies = [
"rustpython-compiler",
"rustpython-doc",
"syn",
"syn-ext",
"syn-ext 0.4.0",
"textwrap 0.15.0",
]
@@ -2120,6 +2120,15 @@ dependencies = [
"syn",
]
[[package]]
name = "syn-ext"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b86cb2b68c5b3c078cac02588bc23f3c04bb828c5d3aedd17980876ec6a7be6"
dependencies = [
"syn",
]
[[package]]
name = "system-configuration"
version = "0.5.0"
+2 -1
View File
@@ -4,6 +4,7 @@ use crate::{
convert::ToPyObject,
identifier,
protocol::{PyIter, PyIterIter, PyMapping, PyMappingMethods},
types::AsMapping,
AsObject, PyObject, PyObjectRef, PyPayload, PyResult, TryFromObject, VirtualMachine,
};
use std::{borrow::Borrow, marker::PhantomData};
@@ -110,7 +111,7 @@ impl ArgMapping {
pub fn from_dict_exact(dict: PyDictRef) -> Self {
Self {
obj: dict.into(),
mapping_methods: PyDict::MAPPING_METHODS,
mapping_methods: PyDict::AS_MAPPING,
}
}
+4 -5
View File
@@ -896,15 +896,14 @@ pub trait AsBuffer: PyPayload {
#[pyimpl]
pub trait AsMapping: PyPayload {
const AS_MAPPING: PyMappingMethods;
#[inline]
#[pyslot]
fn slot_as_mapping(zelf: &PyObject, vm: &VirtualMachine) -> PyMappingMethods {
let zelf = unsafe { zelf.downcast_unchecked_ref::<Self>() };
Self::as_mapping(zelf, vm)
fn as_mapping(_zelf: &PyObject, _vm: &VirtualMachine) -> PyMappingMethods {
Self::AS_MAPPING
}
fn as_mapping(zelf: &Py<Self>, vm: &VirtualMachine) -> PyMappingMethods;
fn mapping_downcast<'a>(mapping: &'a PyMapping) -> &'a Py<Self> {
unsafe { mapping.obj.downcast_unchecked_ref() }
}