From 307fac7802e58465d6d77d53cb231e5abbd81491 Mon Sep 17 00:00:00 2001 From: Padraic Fanning Date: Sat, 30 Oct 2021 12:43:17 -0400 Subject: [PATCH] Draft methods for Token object --- stdlib/src/contextvars.rs | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/stdlib/src/contextvars.rs b/stdlib/src/contextvars.rs index 7931beeb5..bb43caf12 100644 --- a/stdlib/src/contextvars.rs +++ b/stdlib/src/contextvars.rs @@ -150,8 +150,41 @@ mod _contextvars { #[derive(Debug, PyValue)] struct ContextToken {} + #[derive(FromArgs)] + struct ContextTokenOptions { + #[pyarg(positional)] + #[allow(dead_code)] // TODO: RUSTPYTHON + context: PyObjectRef, + #[pyarg(positional)] + #[allow(dead_code)] // TODO: RUSTPYTHON + var: PyObjectRef, + #[pyarg(positional)] + #[allow(dead_code)] // TODO: RUSTPYTHON + old_value: PyObjectRef, + } + #[pyimpl] - impl ContextToken {} + impl ContextToken { + #[pymethod(magic)] + fn init(&self, _args: ContextTokenOptions, _vm: &VirtualMachine) -> PyResult<()> { + unimplemented!("Token.__init__() is currently under construction") + } + + #[pyproperty] + fn var(&self, _vm: &VirtualMachine) -> PyObjectRef { + unimplemented!("Token.var() is currently under construction") + } + + #[pyproperty] + fn old_value(&self, _vm: &VirtualMachine) -> PyObjectRef { + unimplemented!("Token.old_value() is currently under construction") + } + + #[pymethod(magic)] + fn repr(_zelf: PyRef, _vm: &VirtualMachine) -> String { + unimplemented!("") + } + } #[pyfunction] fn copy_context() {}