Struct rerun::dataframe::EntityPathFilter
source · pub struct EntityPathFilter {
rules: BTreeMap<EntityPathRule, RuleEffect>,
}
Expand description
A way to filter a set of EntityPath
s.
This implements as simple set of include/exclude rules:
+ /world/** # add everything…
- /world/roads/** # …but remove all roads…
+ /world/roads/main # …but show main road
If there is multiple matching rules, the most specific rule wins. If there are multiple rules of the same specificity, the last one wins. If no rules match, the path is excluded.
The /**
suffix matches the whole subtree, i.e. self and any child, recursively
(/world/**
matches both /world
and /world/car/driver
).
Other uses of *
are not (yet) supported.
EntityPathFilter
sorts the rule by entity path, with recursive coming before non-recursive.
This means the last matching rule is also the most specific one.
For instance:
+ /world/**
- /world
- /world/car/**
+ /world/car/driver
The last rule matching /world/car/driver
is + /world/car/driver
, so it is included.
The last rule matching /world/car/hood
is - /world/car/**
, so it is excluded.
The last rule matching /world
is - /world
, so it is excluded.
The last rule matching /world/house
is + /world/**
, so it is included.
Fields§
§rules: BTreeMap<EntityPathRule, RuleEffect>
Implementations§
source§impl EntityPathFilter
impl EntityPathFilter
sourcepub fn parse_forgiving(
rules: &str,
subst_env: &EntityPathSubs
) -> EntityPathFilter
pub fn parse_forgiving( rules: &str, subst_env: &EntityPathSubs ) -> EntityPathFilter
Parse an entity path filter from a string while ignore syntax errors.
Example of rules:
+ /world/**
- /world/roads/**
+ /world/roads/main
Each line is a rule.
The first character should be +
or -
. If missing, +
is assumed.
The rest of the line is trimmed and treated as an entity path.
Conflicting rules are resolved by the last rule.
sourcepub fn from_query_expressions_forgiving<'a>(
rules: impl IntoIterator<Item = &'a str>,
subst_env: &EntityPathSubs
) -> EntityPathFilter
pub fn from_query_expressions_forgiving<'a>( rules: impl IntoIterator<Item = &'a str>, subst_env: &EntityPathSubs ) -> EntityPathFilter
Build a filter from a list of query expressions.
Each item in the iterator should be a query expression.
The first character should be +
or -
. If missing, +
is assumed.
The rest of the expression is trimmed and treated as an entity path.
Conflicting rules are resolved by the last rule.
sourcepub fn parse_strict(
rules: &str,
subst_env: &EntityPathSubs
) -> Result<EntityPathFilter, EntityPathFilterParseError>
pub fn parse_strict( rules: &str, subst_env: &EntityPathSubs ) -> Result<EntityPathFilter, EntityPathFilterParseError>
Parse an entity path filter from a string, returning an error if the syntax is invalid.
Example of rules:
+ /world/**
- /world/roads/**
+ /world/roads/main
Each line is a rule.
The first character should be +
or -
. If missing, +
is assumed.
The rest of the line is trimmed and treated as an entity path.
Conflicting rules are resolved by the last rule.
sourcepub fn from_query_expressions_strict<'a>(
rules: impl IntoIterator<Item = &'a str>,
subst_env: &EntityPathSubs
) -> Result<EntityPathFilter, EntityPathFilterParseError>
pub fn from_query_expressions_strict<'a>( rules: impl IntoIterator<Item = &'a str>, subst_env: &EntityPathSubs ) -> Result<EntityPathFilter, EntityPathFilterParseError>
Build a filter from a list of query expressions.
Each item in the iterator should be a query expression.
The first character should be +
or -
. If missing, +
is assumed.
The rest of the expression is trimmed and treated as an entity path.
Conflicting rules are resolved by the last rule.
sourcepub fn all() -> EntityPathFilter
pub fn all() -> EntityPathFilter
Creates a filter that accepts everything.
sourcepub fn single_entity_filter(entity_path: &EntityPath) -> EntityPathFilter
pub fn single_entity_filter(entity_path: &EntityPath) -> EntityPathFilter
Creates a new entity path filter that includes only a single entity.
sourcepub fn subtree_entity_filter(entity_path: &EntityPath) -> EntityPathFilter
pub fn subtree_entity_filter(entity_path: &EntityPath) -> EntityPathFilter
Creates a new entity path filter that includes a single subtree.
pub fn add_rule(&mut self, effect: RuleEffect, rule: EntityPathRule)
pub fn iter_expressions(&self) -> impl Iterator<Item = String>
pub fn formatted(&self) -> String
sourcepub fn most_specific_match(&self, path: &EntityPath) -> Option<RuleEffect>
pub fn most_specific_match(&self, path: &EntityPath) -> Option<RuleEffect>
Find the most specific matching rule and return its effect.
If no rule matches, return None
.
sourcepub fn matches(&self, path: &EntityPath) -> bool
pub fn matches(&self, path: &EntityPath) -> bool
Does this filter include the given entity path?
sourcepub fn matches_exactly(&self, entity_path: &EntityPath) -> bool
pub fn matches_exactly(&self, entity_path: &EntityPath) -> bool
Is there a rule for this exact entity path (ignoring subtree)?
sourcepub fn add_exact(&mut self, clone: EntityPath)
pub fn add_exact(&mut self, clone: EntityPath)
Include this entity, but not the subtree.
sourcepub fn add_subtree(&mut self, clone: EntityPath)
pub fn add_subtree(&mut self, clone: EntityPath)
Include this entity with subtree.
sourcepub fn remove_subtree_and_matching_rules(&mut self, clone: EntityPath)
pub fn remove_subtree_and_matching_rules(&mut self, clone: EntityPath)
Remove a subtree and any existing rules that it would match.
Because most-specific matches win, if we only add a subtree exclusion it can still be overridden by existing inclusions. This method ensures that not only do we add a subtree exclusion, but clear out any existing inclusions or (now redundant) exclusions that would match the subtree.
sourcepub fn remove_rule_for(&mut self, entity_path: &EntityPath)
pub fn remove_rule_for(&mut self, entity_path: &EntityPath)
Remove any rule for the given entity path (ignoring whether or not that rule includes the subtree).
sourcepub fn contains_rule_for_exactly(&self, entity_path: &EntityPath) -> bool
pub fn contains_rule_for_exactly(&self, entity_path: &EntityPath) -> bool
Is there any rule for this entity path?
Whether or not the subtree is included is NOT important.
sourcepub fn is_explicitly_included(&self, entity_path: &EntityPath) -> bool
pub fn is_explicitly_included(&self, entity_path: &EntityPath) -> bool
Is this entity path explicitly included?
Whether or not the subtree is included is NOT important.
sourcepub fn is_explicitly_excluded(&self, entity_path: &EntityPath) -> bool
pub fn is_explicitly_excluded(&self, entity_path: &EntityPath) -> bool
Is this entity path explicitly excluded?
Whether or not the subtree is included is NOT important.
sourcepub fn is_anything_in_subtree_included(&self, path: &EntityPath) -> bool
pub fn is_anything_in_subtree_included(&self, path: &EntityPath) -> bool
Is anything under this path included (including self)?
sourcepub fn is_superset_of(&self, other: &EntityPathFilter) -> bool
pub fn is_superset_of(&self, other: &EntityPathFilter) -> bool
Checks whether this results of this filter “fully contain” the results of another filter.
If this returns true
there should not exist any EntityPath
for which Self::matches
would return true
and the other filter would return false
for this filter.
This check operates purely on the rule expressions and not the actual entity tree, and will thus not reason about entities included in an actual recording: different queries that are not a superset of each other may still query the same entities in given recording.
This is a conservative estimate, and may return false
in situations where the
query does in fact cover the other query. However, it should never return true
in a case where the other query would not be fully covered.
Trait Implementations§
source§impl AddAssign for EntityPathFilter
impl AddAssign for EntityPathFilter
source§fn add_assign(&mut self, rhs: EntityPathFilter)
fn add_assign(&mut self, rhs: EntityPathFilter)
The union of all rules
source§impl Clone for EntityPathFilter
impl Clone for EntityPathFilter
source§fn clone(&self) -> EntityPathFilter
fn clone(&self) -> EntityPathFilter
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for EntityPathFilter
impl Debug for EntityPathFilter
source§impl Default for EntityPathFilter
impl Default for EntityPathFilter
source§fn default() -> EntityPathFilter
fn default() -> EntityPathFilter
source§impl Hash for EntityPathFilter
impl Hash for EntityPathFilter
source§impl PartialEq for EntityPathFilter
impl PartialEq for EntityPathFilter
source§fn eq(&self, other: &EntityPathFilter) -> bool
fn eq(&self, other: &EntityPathFilter) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Sum for EntityPathFilter
impl Sum for EntityPathFilter
source§fn sum<I>(iter: I) -> EntityPathFilterwhere
I: Iterator<Item = EntityPathFilter>,
fn sum<I>(iter: I) -> EntityPathFilterwhere
I: Iterator<Item = EntityPathFilter>,
The union of all rules
source§impl TryFrom<&str> for EntityPathFilter
impl TryFrom<&str> for EntityPathFilter
§type Error = EntityPathFilterParseError
type Error = EntityPathFilterParseError
source§fn try_from(
value: &str
) -> Result<EntityPathFilter, <EntityPathFilter as TryFrom<&str>>::Error>
fn try_from( value: &str ) -> Result<EntityPathFilter, <EntityPathFilter as TryFrom<&str>>::Error>
impl Eq for EntityPathFilter
impl StructuralPartialEq for EntityPathFilter
Auto Trait Implementations§
impl Freeze for EntityPathFilter
impl RefUnwindSafe for EntityPathFilter
impl Send for EntityPathFilter
impl Sync for EntityPathFilter
impl Unpin for EntityPathFilter
impl UnwindSafe for EntityPathFilter
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request