pub enum AliasPolicy {
Refuse,
Follow,
Expand,
}Expand description
What path traversal should do when a segment lands on an alias
(*name) that it needs to descend through.
Reads and writes want different answers. Reading through an alias is
just a lookup, so try_get_path resolves by
default. Writing through one mutates the shared anchor and therefore
every other alias pointing at it, so
try_set_path refuses by default and the
caller has to pick a policy deliberately.
Variants§
Refuse
Refuse to descend, reporting PathError::AliasRefused.
The default for writes.
Follow
Follow the alias to its anchored node.
For reads this is plain resolution. For writes it mutates the anchored node in place, so the change is visible through the anchor and through every other alias that references it.
Expand
Replace the alias with an independent copy of the anchored node, then operate on that copy.
Only meaningful for writes; reads treat it like
Follow, since a read has nothing to write back.
The copy does not carry the original &anchor, so other aliases
keep pointing at the untouched original.
Trait Implementations§
Source§impl Clone for AliasPolicy
impl Clone for AliasPolicy
Source§fn clone(&self) -> AliasPolicy
fn clone(&self) -> AliasPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more