GeezerVison is showing docs.rs — PyObjectRef in rustpython_vm::object - Rust pub struct PyObjectRef { /* private fields */ }
Expand descriptionThe PyObjectRef is one of the most used types. It is a reference to a
python object. A single python object can have multiple references, and
this reference counting is accounted for by this type. Use the .clone()
method to create a new reference and increment the amount of references
to the python object by 1.
Implementations§
Tries converting a python object into a complex, returns an option of whether the complex
and whether the object was a complex originally or coereced into one
Convert Python bool into Rust bool.
§Safety
The raw pointer must have been previously returned from a call to
PyObjectRef::into_raw. The user is responsible for ensuring that the inner data is not
dropped more than once due to mishandling the reference count by calling this function
too many times.
Attempt to downcast this reference to a subclass.
If the downcast fails, the original ref is returned in as Err so
another downcast can be attempted without unnecessary cloning.
Force to downcast this reference to a subclass.
§Safety
T must be the exact payload type
§Safety
T must be the exact payload type
Attempt to downcast this reference to the specific class that is associated T.
If the downcast fails, the original ref is returned in as Err so
another downcast can be attempted without unnecessary cloning.
Force to return payload as T.
§Safety
The actual payload type must be T.
Set the dict field. Returns Err(dict) if this object does not have a dict field
in the first place.
§Safety
T must be the exact payload type
Takes an object and returns an iterator for it.
This is typically a new iterator but if the argument is an iterator, this
returns itself.
CPython _PyObject_GenericGetAttrWithDict
Determines if self is a subclass of cls, either directly, indirectly or virtually
via the subclasscheck magic method.
Determines if self is an instance of cls, either directly, indirectly or virtually via
the instancecheck magic method.
Trait Implementations§
Converts this type into a shared reference of the (usually inferred) input type.
Immutably borrows from an owned value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Executes the destructor for this type. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
impl traverse() with caution! Following those guideline so traverse doesn’t cause memory error!: Read more
Attempt to convert a Python object to a value of this type. Auto Trait Implementations§Blanket Implementations§
Determines if obj actually an instance of cls, this doesn’t call instancecheck, so only
use this if cls is known to have not overridden the base instancecheck magic method.
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬This is a nightly-only experimental API. (clone_to_uninit) Performs copy-assignment from self to dest. Read more
Returns the argument unchanged.
The range of positional arguments permitted by the function signature. Read more
Extracts this item from the next argument(s).
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.
🔬This is a nightly-only experimental API. (arbitrary_self_types) The target type on which the method may be called.
Returns the String produced by Ts Debug implementation.
§Examples
use malachite_base::strings::ToDebugString;
assert_eq!([1, 2, 3].to_debug_string(), "[1, 2, 3]");
assert_eq!(
[vec![2, 3], vec![], vec![4]].to_debug_string(),
"[[2, 3], [], [4]]"
);
assert_eq!(Some(5).to_debug_string(), "Some(5)");
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
|