Skip to main content

ParView

Trait ParView 

Source
pub trait ParView<'a>: ParViewSeal<'a> + Send { }
Available on crate feature rayon only.
Expand description

A parallel view over a single aspect of an entity.

The main difference between this trait and the standard View trait is that this view can be shared between threads, allowing it to be used within parallel iteration in either a ParSystem or a par_query.

All types that implement View also implement ParView, so long as any Component C they view is Send when viewed mutably or Sync when viewed immutably.

§Example

// Define a component.
struct Foo(usize);

// Define a view over that component.
type FooView<'a> = &'a Foo;

Because the Component viewed in the above example implements Sync, the view created above implements ParView.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, Component> ParView<'a> for &'a Component
where Component: Component + Sync,

Source§

impl<'a, Component> ParView<'a> for &'a mut Component
where Component: Component + Send,

Source§

impl<'a, Component> ParView<'a> for Option<&'a Component>
where Component: Component + Sync,

Source§

impl<'a, Component> ParView<'a> for Option<&'a mut Component>
where Component: Component + Send,

Implementors§

Source§

impl<'a> ParView<'a> for Identifier