pub struct Scope { /* private fields */ }Expand description
A position in the visibility tree.
Segments are opaque to Mumble Server Runtime: a flavor puts whatever it wants in them (a
game id, a team id). Two scopes are equal when their paths are equal, so this
derives Ord for use as a map key and for canonicalizing a ScopeSet.
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn child(self, segment: u32) -> Option<Scope>
pub fn child(self, segment: u32) -> Option<Scope>
Extend this scope by one segment.
This is the only constructor beyond Scope::ROOT, and it can only ever
narrow. That is what makes an incoherent view inexpressible rather than
merely invalid: there is no free scope parameter anywhere in the builder.
Returns None past MAX_DEPTH. Saturating instead would silently give
the child its parent’s scope, widening what the flavor asked to restrict -
a privacy leak dressed as a rounding error. Refusing propagates into a
build error that keeps the previous view (guide 11.7).
Sourcepub fn is_prefix_of(self, other: Scope) -> bool
pub fn is_prefix_of(self, other: Scope) -> bool
Whether this scope is a prefix of other (a scope is its own prefix).
Sourcepub fn comparable(self, other: Scope) -> bool
pub fn comparable(self, other: Scope) -> bool
Whether either scope is a prefix of the other.
Reflexive and symmetric by construction. Deliberately not transitive:
/g7 is comparable to both /g7/t2 and /g7/t3, which are not
comparable to each other. That is the point, not a defect.