[][src]Struct broccoli::query::colfind::builder::QueryBuilder

pub struct QueryBuilder<'a, 'b: 'a, T: Aabb> { /* fields omitted */ }

Builder for a query on a DinoTree.

Implementations

impl<'a, 'b: 'a, T: Aabb + Send + Sync> QueryBuilder<'a, 'b, T> where
    T::Num: Send + Sync
[src]

pub fn query_par(
    self,
    joiner: impl Joinable,
    func: impl Fn(PMut<'_, T>, PMut<'_, T>) + Clone + Send + Sync
)
[src]

Perform the query in parallel, switching to sequential as specified by the QueryBuilder::with_switch_height()

pub fn query_par_ext(
    self,
    joiner: impl Joinable,
    sweeper: &mut impl CollisionHandler<T = T> + Splitter + Send + Sync,
    splitter: &mut impl Splitter + Send + Sync
)
[src]

An extended version of find_colliding_pairs. where the user can supply callbacks to when new worker tasks are spawned and joined by rayon. Allows the user to potentially collect some aspect of every aabb collision in parallel.

sweeper : The splitter div/add functions will be called every time a new parallel recurse is started. splitter: The splitter div/add will be called at every level of recursion.

Examples

 use broccoli::{prelude::*,RayonJoin,rect,bbox,query,query::colfind::builder::Consumer};
 let mut bots = [bbox(rect(0,10,0,10),0u8),bbox(rect(5,15,5,15),1u8)];
 let mut tree = broccoli::new(&mut bots);

 let mut handler=query::colfind::builder::from_closure(
     &tree,
     Vec::new(),
     |_|(Vec::new(),Vec::new()),        //Start a new thread
     |a,mut b,mut c|{a.append(&mut b);a.append(&mut c)}, //Combine two threads
     |v,a,b|v.push((*a.unpack_inner(),*b.unpack_inner())), //Handle a collision
 );

 tree.new_builder().query_par_ext(
     RayonJoin,
     &mut handler,
     &mut broccoli::build::SplitterEmpty
 );

 let intersections=handler.consume();

 assert_eq!(intersections.len(),1);

impl<'a, 'b: 'a, T: Aabb> QueryBuilder<'a, 'b, T>[src]

#[must_use]pub fn with_switch_height(mut self: Self, height: usize) -> Self[src]

Choose a custom height at which to switch from parallel to sequential. If you end up building sequentially, this option is ignored.

pub fn query_seq(self, func: impl FnMut(PMut<'_, T>, PMut<'_, T>))[src]

Perform the query sequentially.

pub fn query_with_splitter_seq(
    self,
    func: impl FnMut(PMut<'_, T>, PMut<'_, T>),
    splitter: &mut impl Splitter
)
[src]

Perform the query sequentially with splitter functions getting called at every level of recursion.

Auto Trait Implementations

impl<'a, 'b, T> RefUnwindSafe for QueryBuilder<'a, 'b, T> where
    T: RefUnwindSafe,
    <T as Aabb>::Num: RefUnwindSafe
[src]

impl<'a, 'b, T> Send for QueryBuilder<'a, 'b, T> where
    T: Send,
    <T as Aabb>::Num: Send
[src]

impl<'a, 'b, T> Sync for QueryBuilder<'a, 'b, T> where
    T: Sync,
    <T as Aabb>::Num: Sync
[src]

impl<'a, 'b, T> Unpin for QueryBuilder<'a, 'b, T> where
    'b: 'a, 
[src]

impl<'a, 'b, T> !UnwindSafe for QueryBuilder<'a, 'b, T>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.