pub struct Ptr<T> { /* fields omitted */ }
Ptr is essentially a wrapper around Option<Weak<RefCell<T>>>
,
a.k.a. a nullable ref-counted pointer with interior mutability
This abstraction is used to get around Rust's
validity, borrowing, and ownership rules, especially when constructing or
extending the half-edge mesh.
Taken by value, so it moves the value out.
Use this for constructing brand new objects.
Returns an Rc<RefCell<T>>
, not a Ptr<T>
,
don't get em mixed up
Taken by reference to an existing object. Creates a Ptr
Creates what is effectively a null pointer
Used as a utility function to merge the upgrade of two weak pointers
into a single Option wrapping the success of both upgrades
Check if the pointer is valid. Requires the pointer to upgrade in order to check
that it still points at an existing object
Used as a utility function for upgrading the stored weak pointer.
Converts from Option<Weak<RefCell<T>>>
to Option<& Weak<RefCell<T>>>
Like the function of the same name on Option
Formats the value using the given formatter. Read more
Performs copy-assignment from source
. Read more