concision_core/ops/pad/
padding.rs

1/*
2    Appellation: padding <module>
3    Contrib: @FL03
4*/
5use super::{PadAction, PadMode, Padding};
6
7impl<T> Padding<T> {
8    pub fn new() -> Self {
9        Self {
10            action: PadAction::default(),
11            mode: PadMode::default(),
12            pad: Vec::new(),
13            padding: 0,
14        }
15    }
16
17    pub fn pad(&self) -> &[[usize; 2]] {
18        &self.pad
19    }
20
21    pub fn with_action(mut self, action: PadAction) -> Self {
22        self.action = action;
23        self
24    }
25
26    pub fn with_mode(mut self, mode: PadMode<T>) -> Self {
27        self.mode = mode;
28        self
29    }
30
31    pub fn with_padding(mut self, padding: usize) -> Self {
32        self.padding = padding;
33        self
34    }
35}