Skip to main content

Position

Trait Position 

Source
pub trait Position: Send + Sync {
    // Required methods
    fn compute(&self, data: &mut DataFrame, params: &PositionParams);
    fn name(&self) -> &str;

    // Provided methods
    fn per_panel(&self) -> bool { ... }
    fn validate(&self, _warnings: &mut Vec<String>) { ... }
}
Expand description

Trait for position adjustments.

Required Methods§

Source

fn compute(&self, data: &mut DataFrame, params: &PositionParams)

Adjust positions for data.

Source

fn name(&self) -> &str

Provided Methods§

Source

fn per_panel(&self) -> bool

Whether this position must run separately per facet panel rather than once on the pooled rows before facets are split (B3-3, D8). Default false. PositionStack/PositionFill override this to true — a shared x category’s stack height must not mix rows from different panels. Dodge and jitter stay pooled across panels for now (a follow-up, sipemu/ggplot-rs#154).

Source

fn validate(&self, _warnings: &mut Vec<String>)

Validate this position’s own parameters once per layer (D2); default no-op. Implementations push a warning and fall back to a sane default rather than panicking or silently miscomputing.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§