<commit_before>/// Trait of dispatcher.
///
/// A (collision) dispatcher typically takes two bodies in parameter and return the corresponding
/// narrow phase algorithm.
pub trait Dispatcher<G1, G2, NF> {
    /// Deduce the narrow phase from two bodies.
    fn dispatch(&self, &G1, &G2) -> Option<NF>;
    /// Tells whether a collision between two bodies can occur.
    fn is_valid(&self, &G1, &G2) -> bool;
}

/// Dispatcher which disallows dispatches between identical pointers.
///
/// It has no result.
pub struct NoIdDispatcher<B>;

impl<B> Dispatcher<B, B, ()> for NoIdDispatcher<B> {
    #[inline]
    fn dispatch(&self, _: &B, _: &B) -> Option<()> {
        Some(())
    }

    #[inline]
    fn is_valid(&self, a: &B, b: &B) -> bool {
        a as *const B != b as *const B
    }
}<commit_msg>Add a `::new()` constructor for `NoIdDispatcher`.<commit_after>/// Trait of dispatcher.
///
/// A (collision) dispatcher typically takes two bodies in parameter and return the corresponding
/// narrow phase algorithm.
pub trait Dispatcher<G1, G2, NF> {
    /// Deduce the narrow phase from two bodies.
    fn dispatch(&self, &G1, &G2) -> Option<NF>;
    /// Tells whether a collision between two bodies can occur.
    fn is_valid(&self, &G1, &G2) -> bool;
}

/// Dispatcher which disallows dispatches between identical pointers.
///
/// It has no result.
pub struct NoIdDispatcher<B>;

impl<B> NoIdDispatcher<B> {
    /// Creates a new `NoIdDispatcher`.
    pub fn new() -> NoIdDispatcher<B> {
        NoIdDispatcher
    }
}

impl<B> Dispatcher<B, B, ()> for NoIdDispatcher<B> {
    #[inline]
    fn dispatch(&self, _: &B, _: &B) -> Option<()> {
        Some(())
    }

    #[inline]
    fn is_valid(&self, a: &B, b: &B) -> bool {
        a as *const B != b as *const B
    }
}
{'fraction_non_alphanumeric': 0.15691788526434194, 'fraction_numerical': 0.006749156355455568, 'mean_word_length': 2.7531645569620253, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2724219', 'n_tokens_mistral': 613, 'n_tokens_neox': 587, 'n_words': 202}