Struct rustpython_vm::vm::Context
source · pub struct Context {Show 13 fields
pub true_value: PyIntRef,
pub false_value: PyIntRef,
pub none: PyRef<PyNone>,
pub empty_tuple: PyTupleRef,
pub empty_frozenset: PyRef<PyFrozenSet>,
pub empty_str: &'static PyStrInterned,
pub empty_bytes: PyRef<PyBytes>,
pub ellipsis: PyRef<PyEllipsis>,
pub not_implemented: PyRef<PyNotImplemented>,
pub types: TypeZoo,
pub exceptions: ExceptionZoo,
pub int_cache_pool: Vec<PyIntRef>,
pub names: ConstName,
/* private fields */
}
Fields§
§true_value: PyIntRef
§false_value: PyIntRef
§none: PyRef<PyNone>
§empty_tuple: PyTupleRef
§empty_frozenset: PyRef<PyFrozenSet>
§empty_str: &'static PyStrInterned
§empty_bytes: PyRef<PyBytes>
§ellipsis: PyRef<PyEllipsis>
§not_implemented: PyRef<PyNotImplemented>
§types: TypeZoo
§exceptions: ExceptionZoo
§int_cache_pool: Vec<PyIntRef>
§names: ConstName
Implementations§
source§impl Context
impl Context
pub const INT_CACHE_POOL_RANGE: RangeInclusive<i32> = _
pub fn genesis() -> &'static PyRc<Self>
pub fn intern_str<S: InternableString>(&self, s: S) -> &'static PyStrInterned
pub fn interned_str<S: MaybeInternedString + ?Sized>( &self, s: &S ) -> Option<&'static PyStrInterned>
pub fn none(&self) -> PyObjectRef
pub fn ellipsis(&self) -> PyObjectRef
pub fn not_implemented(&self) -> PyObjectRef
pub fn new_pyref<T, P>(&self, value: T) -> PyRef<P>where T: Into<P>, P: PyPayload,
pub fn new_int<T: Into<BigInt> + ToPrimitive>(&self, i: T) -> PyIntRef
pub fn new_bigint(&self, i: &BigInt) -> PyIntRef
pub fn new_float(&self, value: f64) -> PyRef<PyFloat>
pub fn new_complex(&self, value: Complex64) -> PyRef<PyComplex>
pub fn new_str(&self, s: impl Into<PyStr>) -> PyRef<PyStr>
pub fn interned_or_new_str<S, M>(&self, s: S) -> PyRef<PyStr>where S: Into<PyStr> + AsRef<M>, M: MaybeInternedString,
pub fn new_bytes(&self, data: Vec<u8>) -> PyRef<PyBytes>
pub fn new_bool(&self, b: bool) -> PyIntRef
pub fn new_tuple(&self, elements: Vec<PyObjectRef>) -> PyTupleRef
pub fn new_list(&self, elements: Vec<PyObjectRef>) -> PyListRef
pub fn new_dict(&self) -> PyDictRef
pub fn new_class( &self, module: Option<&str>, name: &str, base: PyTypeRef, slots: PyTypeSlots ) -> PyTypeRef
pub fn new_exception_type( &self, module: &str, name: &str, bases: Option<Vec<PyTypeRef>> ) -> PyTypeRef
pub fn new_method_def<F, FKind>( &self, name: &'static str, f: F, flags: PyMethodFlags, doc: Option<&'static str> ) -> PyRef<HeapMethodDef>where F: IntoPyNativeFn<FKind>,
pub fn new_member( &self, name: &str, member_kind: MemberKind, getter: fn(_: &VirtualMachine, _: PyObjectRef) -> PyResult, setter: Option<fn(_: &VirtualMachine, _: PyObjectRef, _: PySetterValue) -> PyResult<()>>, class: &'static Py<PyType> ) -> PyRef<PyMemberDescriptor>
pub fn new_readonly_getset<F, T>( &self, name: impl Into<String>, class: &'static Py<PyType>, f: F ) -> PyRef<PyGetSet>where F: IntoPyGetterFunc<T>,
pub fn new_getset<G, S, T, U>( &self, name: impl Into<String>, class: &'static Py<PyType>, g: G, s: S ) -> PyRef<PyGetSet>where G: IntoPyGetterFunc<T>, S: IntoPySetterFunc<U>,
pub fn new_base_object( &self, class: PyTypeRef, dict: Option<PyDictRef> ) -> PyObjectRef
pub fn new_code(&self, code: impl IntoCodeObject) -> PyRef<PyCode>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more