pub struct Context {Show 14 fields
pub true_value: PyRef<PyBool>,
pub false_value: PyRef<PyBool>,
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 typing_no_default: PyRef<NoDefault>,
pub types: TypeZoo,
pub exceptions: ExceptionZoo,
pub int_cache_pool: Vec<PyIntRef>,
pub names: ConstName,
/* private fields */
}Fields§
§true_value: PyRef<PyBool>§false_value: PyRef<PyBool>§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>§typing_no_default: PyRef<NoDefault>§types: TypeZoo§exceptions: ExceptionZoo§int_cache_pool: Vec<PyIntRef>§names: ConstNameImplementations§
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 not_implemented(&self) -> PyObjectRef
pub fn empty_tuple_typed<T>(&self) -> &Py<PyTuple<T>>
pub fn new_pyref<T, P>(&self, value: T) -> PyRef<P>
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 latin1_char(&self, ch: u8) -> PyRef<PyStr>
pub fn new_str(&self, s: impl Into<PyStr>) -> PyRef<PyStr>
pub fn new_utf8_str(&self, s: impl Into<PyUtf8Str>) -> PyRef<PyUtf8Str>
pub fn interned_or_new_str<S, M>(&self, s: S) -> PyRef<PyStr>
pub fn new_bytes(&self, data: Vec<u8>) -> PyRef<PyBytes>
pub fn new_bytearray(&self, data: Vec<u8>) -> PyRef<PyByteArray>
pub fn new_bool(&self, b: bool) -> PyRef<PyBool>
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
Sourcepub fn new_exception_type_with_doc(
&self,
module: &str,
name: &str,
bases: Option<Vec<PyTypeRef>>,
doc: ItemDoc,
) -> PyTypeRef
pub fn new_exception_type_with_doc( &self, module: &str, name: &str, bases: Option<Vec<PyTypeRef>>, doc: ItemDoc, ) -> PyTypeRef
Like new_exception_type, with doc as the new type’s __doc__.
pub fn new_method_def<F, FKind>(
&self,
name: &'static str,
f: F,
flags: PyMethodFlags,
doc: ItemDoc,
) -> PyRef<HeapMethodDef>where
F: IntoPyNativeFn<FKind>,
pub fn new_member( &self, name: &str, kind: MemberKind, offset: isize, flags: PyMemberFlags, class: &'static Py<PyType>, doc: ItemDoc, ) -> PyRef<PyMemberDescriptor>
pub fn new_readonly_tuple_member( &self, name: &str, class: &'static Py<PyType>, index: usize, doc: ItemDoc, ) -> PyRef<PyMemberDescriptor>
pub fn new_readonly_getset<F, T>(
&self,
name: &str,
class: &'static Py<PyType>,
f: F,
) -> PyRef<PyGetSet>where
F: IntoPyGetterFunc<T>,
pub fn new_static_getset<G, S, T, U>(
&self,
name: &str,
class: &'static Py<PyType>,
g: G,
s: S,
) -> PyRef<PyGetSet>where
G: IntoPyGetterFunc<T>,
S: IntoPySetterFunc<U>,
Sourcepub fn new_getset<G, S, T, U>(
&self,
name: &str,
class: &Py<PyType>,
g: G,
s: S,
) -> PyRef<PyGetSet>where
G: IntoPyGetterFunc<T>,
S: IntoPySetterFunc<U>,
pub fn new_getset<G, S, T, U>(
&self,
name: &str,
class: &Py<PyType>,
g: G,
s: S,
) -> PyRef<PyGetSet>where
G: IntoPyGetterFunc<T>,
S: IntoPySetterFunc<U>,
Creates a new PyGetSet with a heap type.
pub fn new_base_object( &self, class: PyTypeRef, dict: Option<PyDictRef>, ) -> PyObjectRef
pub fn new_code(&self, code: impl IntoCodeObject) -> PyRef<PyCode>
pub fn new_capsule( &self, ptr: *mut c_void, name: Option<&'static CStr>, destructor: Option<unsafe extern "C" fn(*mut PyObject)>, ) -> PyRef<PyCapsule>
Trait Implementations§
Source§impl AsRef<Context> for VirtualMachine
impl AsRef<Context> for VirtualMachine
Auto Trait Implementations§
impl !Freeze for Context
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl !UnwindSafe for Context
impl Unpin for Context
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> Helper for T
Source§impl<T, U> ImaginaryInto<U> for Twhere
U: ImaginaryFrom<T>,
impl<T, U> ImaginaryInto<U> for Twhere
U: ImaginaryFrom<T>,
fn imaginary_into(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more