noxu_db/join_config.rs
1//! Configuration for JoinCursor.
2//!
3//! Implements `JoinConfig` with one field: `no_sort`.
4
5/// Configuration properties for a [`JoinCursor`][crate::join_cursor::JoinCursor].
6///
7/// Pass to [`Database::join`][crate::database::Database::join] to control join
8/// cursor behaviour.
9///
10/// # Default
11///
12/// * `no_sort = false` — cursors are automatically sorted by estimated
13/// duplicate count (smallest set first) so that the join algorithm can
14/// prune candidates as early as possible. Set `no_sort = true` if you
15/// have already ordered the cursor array optimally.
16#[derive(Clone, Debug, Default)]
17pub struct JoinConfig {
18 /// Disables automatic cursor sorting when `true`.
19 pub no_sort: bool,
20}
21
22impl JoinConfig {
23 /// Creates a new `JoinConfig` with all defaults.
24 pub fn new() -> Self {
25 Self::default()
26 }
27
28 /// Sets whether automatic cursor sorting is disabled.
29 pub fn set_no_sort(&mut self, no_sort: bool) {
30 self.no_sort = no_sort;
31 }
32
33 /// Builder-style `no_sort` setter.
34 pub fn with_no_sort(mut self, no_sort: bool) -> Self {
35 self.no_sort = no_sort;
36 self
37 }
38
39 /// Returns `true` if automatic cursor sorting is disabled.
40 pub fn get_no_sort(&self) -> bool {
41 self.no_sort
42 }
43}