Expand description
This crate provides object-oriented inheritance using Nodes.
A Node consits of a set of components and a Node can have other children nodes.
§Defining classes
Use the class!
invocation for defining class.
§Components
use oop_inheritance::*;
let something = Node::new();
// Set a component
something.set::<f64>(10);
// `Option<Arc<f64>>`
something.get::<f64>();
§Children
ⓘ
something.add_child(&another_thing);
§Node paths
Since Nodes are in hierarchy, every Node that has a name may be found when
using the .resolve_path
method. However, there are special segments of an Node path that do not resolve
by name, which may be useful in some contexts:
.first
resolves to the first child of an Node;.last
resolves to the last child of an Node;..
resolves to the parent.
let last_sibling: Option<Node> = node.resolve_path("../.last");
Modules§
Macros§
- class
- Defines a class.
Structs§
- Class
Error - Represents an error originated from Node subclass relationships. For example, this error might occur as result of a failed conversion.
- Node
- Represents an node as a type managed by reference-counting.
- Weak
Node Ref - Represents a weak reference to an node.