pub struct NodeScene {
pub is_owner: bool,
/* private fields */
}
Expand description
A recursive structure that allows for the storage, saving, and loading of a dormant scene of nodes. The root node is what every node in the scene will have its owner set to.
Fields§
§is_owner: bool
Implementations§
Source§impl NodeScene
impl NodeScene
Sourcepub fn load_from_str(document: &str) -> Result<Self, String>
pub fn load_from_str(document: &str) -> Result<Self, String>
Loads a NodeScene
from a string.
Sourcepub fn save_to_str(&self) -> Result<String, String>
pub fn save_to_str(&self) -> Result<String, String>
Saves a NodeScene
to a string.
Sourcepub fn save(&self, path: &Path, name: &str) -> Result<(), String>
pub fn save(&self, path: &Path, name: &str) -> Result<(), String>
Saves a NodeScene
to a toml
like .scn
file.
Sourcepub fn structural_hash(&self) -> u64
pub fn structural_hash(&self) -> u64
Recursively builds a hash that represents the scene layout. This will NOT check node fields, but will only compare the shape, ownership, and types present throughout a scene tree.
This can be useful to test for scene changes across loading and saving.
§Note
This uses the default hasher. The Hash
trait is also implemented to support hashing with
other hash functions.
Sourcepub fn append_as_owner(&mut self, child: NodeScene)
pub fn append_as_owner(&mut self, child: NodeScene)
Appends an owning NodeScene
as a child, ensuring that the root node of the added
NodeScene
is always an owner.
Sourcepub unsafe fn get_node(&self) -> Box<dyn Node>
pub unsafe fn get_node(&self) -> Box<dyn Node>
Returns this NodeScene
instance’s associated node.
§Safety
This is marked unsafe as if the resulting Box<T>
is dropped, the internal pointer could
be invalidated.
Sourcepub fn update_internal(&self, counter: u64)
pub fn update_internal(&self, counter: u64)
Updates the internal RIDs.