pub struct Target {
pub name: String,
/* private fields */
}Expand description
A writer’s declaration of what it accepts.
Fields§
§name: StringImplementations§
Source§impl Target
impl Target
pub fn new(name: impl Into<String>) -> Self
pub fn rule(self, name: &str, legality: Legality) -> Self
pub fn legal(self, name: &str) -> Self
pub fn illegal(self, name: &str) -> Self
pub fn dynamic( self, name: &str, check: impl Fn(&World, Entity) -> bool + Send + Sync + 'static, ) -> Self
Sourcepub fn covered(
self,
name: &str,
what: &str,
check: fn(&World, Entity) -> bool,
) -> Self
pub fn covered( self, name: &str, what: &str, check: fn(&World, Entity) -> bool, ) -> Self
A name the writer writes through another component: legal on the entities check accepts, what naming the
cover ("covered by <dialect>.light"); the rest are reported as <name> not <what> (Legality::Covered).
Sourcepub fn dynamic_typed<T: Component>(
self,
check: impl Fn(&T) -> bool + Send + Sync + 'static,
) -> Self
pub fn dynamic_typed<T: Component>( self, check: impl Fn(&T) -> bool + Send + Sync + 'static, ) -> Self
The legal checks of a typed component: legal when check accepts the value.
Sourcepub fn check<T: Component>(
self,
what: &str,
check: impl Fn(&T) -> bool + Send + Sync + 'static,
) -> Self
pub fn check<T: Component>( self, what: &str, check: impl Fn(&T) -> bool + Send + Sync + 'static, ) -> Self
A named value rule on a typed component: as Target::dynamic_typed, with what naming the rule in errors
(“every placement regular”).
Sourcepub fn check_resource<R: Resource>(
self,
what: &str,
check: impl Fn(&R) -> bool + Send + Sync + 'static,
) -> Self
pub fn check_resource<R: Resource>( self, what: &str, check: impl Fn(&R) -> bool + Send + Sync + 'static, ) -> Self
A named value rule on a resource: the target refuses the world while the resource is there and check refuses
it ("every surface classified"). A pass of the stated pipeline that modifies or removes the resource fixes it.
Sourcepub fn rule_words(&self, name: &str) -> Option<&str>
pub fn rule_words(&self, name: &str) -> Option<&str>
The words naming the value rule on name (a component’s Target::check, a covered name’s cover
(Target::covered) or a resource’s Target::check_resource), if it has a named one.
Sourcepub fn refused_resources(&self, w: &World) -> Vec<&str>
pub fn refused_resources(&self, w: &World) -> Vec<&str>
The resources of w whose value rule refuses them, by name.
pub fn legality(&self, name: &str) -> Option<&Legality>
Sourcepub fn rules(&self) -> Vec<(&str, Rule)>
pub fn rules(&self) -> Vec<(&str, Rule)>
Every name the target states a rule for, with the rule’s kind (its checks left out): what a coverage report lists of the writer.
Sourcepub fn checked_resources(&self) -> Vec<&str>
pub fn checked_resources(&self) -> Vec<&str>
The resources it checks the values of (Target::check_resource), by name.
Sourcepub fn check_prepared(&self, w: &World) -> Prepared
pub fn check_prepared(&self, w: &World) -> Prepared
Check a prepared world against the target without changing it: what the writer won’t write (an illegal or an
unlisted name, and a covered name’s uncovered entities: Prepared::unsupported, entity counts by name; a
resource it neither lists nor rules on: Prepared::unsupported_resources; the conversion’s own resources,
crate::convert::OPERATIONAL_RESOURCES, aside), and values of names it writes that its value rule refuses
(Prepared::invalid, by name with the rule’s words) or resources it refuses (Prepared::invalid_resources).
A resource is listed like a component (Target::legal, Target::illegal).