#[non_exhaustive]pub struct PlanConfig { /* private fields */ }Expand description
Piece length limits and cut preferences for plan.
Implementations§
Source§impl PlanConfig
impl PlanConfig
Sourcepub fn new(
min: Duration,
target: Duration,
max: Duration,
) -> Result<Self, ConfigError>
pub fn new( min: Duration, target: Duration, max: Duration, ) -> Result<Self, ConfigError>
Pieces never longer than max, preferably target long and not shorter than min.
max is a hard limit that includes padding. min is soft: a shorter piece is penalized
(Weights::short) and flagged Piece::too_short. Silence is kept (Gap::Keep) and cuts inside
silence go to the quietest point (Placement::Quietest).
§Errors
ConfigError::InvalidLengths unless min <= target <= max and target is non-zero.
Sourcepub fn count(self, count: NonZeroUsize) -> Self
pub fn count(self, count: NonZeroUsize) -> Self
Asks for exactly count pieces, each targeting an equal share of the audio. min and
max still apply; fewer pieces are returned only when there are not enough cut positions.
Sourcepub fn placement(self, placement: Placement) -> Result<Self, ConfigError>
pub fn placement(self, placement: Placement) -> Result<Self, ConfigError>
Sets where a cut goes inside a long silence when silence is kept.
§Errors
ConfigError::InvalidRatio if a Placement::Ratio is outside 0.0..=1.0.
Sourcepub fn weights(self, weights: Weights) -> Result<Self, ConfigError>
pub fn weights(self, weights: Weights) -> Result<Self, ConfigError>
Sets the cost weights.
§Errors
ConfigError::InvalidWeights if a weight is negative or not finite, the per-cut cost is
zero, or pause_ref is zero.