pub enum ScenePathError {
InvalidNode(NodeId),
EmptyPath,
TooDeep,
NameTooLong {
component: usize,
},
NotFound {
component: usize,
parent: Option<NodeId>,
},
Ambiguous {
component: usize,
parent: Option<NodeId>,
},
NotDescendant {
node: NodeId,
ancestor: NodeId,
},
}Expand description
Checked hierarchy lookup/inspection errors, separate from SceneError so
existing scene mutation error matches remain compatible. Component indices
are zero-based, relative to the supplied parent (or the scene’s roots).
Duplicate names remain legal in a scene. Path operations reject an ambiguous
step immediately, even if only one matching sibling has the requested suffix.
Use an already known NodeId as the parent to address its children instead.
use ferravex_play::scene::{Scene, ScenePathError, Transform};
let mut scene = Scene::new();
let first = scene.create("actor", Transform::default(), None)?;
scene.create("actor", Transform::default(), None)?;
assert_eq!(scene.resolve_path(None, &["actor"]),
Err(ScenePathError::Ambiguous { component: 0, parent: None }));
assert_eq!(scene.resolve_path(Some(first), &[])?, first);Variants§
InvalidNode(NodeId)
A supplied handle is stale or missing. Foreign-scene handles whose slot
and generation coincide cannot be detected; see NodeId.
EmptyPath
An empty absolute path cannot select a node; scenes have no implicit root.
TooDeep
A path exceeds the scene’s maximum of 100,000 name components.
NameTooLong
A component exceeds the existing 4,096-byte UTF-8 node-name limit.
NotFound
No direct child (or root when parent is None) has this name.
Ambiguous
More than one direct child (or root) has this name. Never picks the first.
NotDescendant
Both handles are live, but node is neither ancestor nor its descendant.
Trait Implementations§
Source§impl Clone for ScenePathError
impl Clone for ScenePathError
Source§fn clone(&self) -> ScenePathError
fn clone(&self) -> ScenePathError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more