pub trait Trellis<const DEGREE: usize> {
type Frame<'a>: Copy
where Self: 'a;
const REACH: u8 = 1;
// Required methods
fn num_frames(&self) -> usize;
fn num_positions(&self) -> usize;
fn frame(&self, frame: usize) -> Self::Frame<'_>;
fn steps_into(
&self,
frame: Self::Frame<'_>,
position: usize,
) -> [Step; DEGREE];
}Expand description
T frames against N + 1 positions, one frame consumed per transition.
DEGREE is how many transitions enter every cell, four for the chain
align uses. They are listed best-first: the solver
keeps the first of them that is strictly better than what it has, so the
order is the tie-break, and a trellis states its own by the order it lists
them in.
See the module docs for a worked implementation.
Provided Associated Constants§
Sourceconst REACH: u8 = 1
const REACH: u8 = 1
The most positions any one transition advances. One for a chain, where a frame either holds its position or moves to the next; more for a trellis that can pass over several positions at once, such as one that gives up a whole word.
It sets how wide the band has to be, so an overstated REACH costs
work while an understated one is a contract violation.
Required Associated Types§
Required Methods§
Sourcefn num_frames(&self) -> usize
fn num_frames(&self) -> usize
The number of frames to be accounted for.
Sourcefn num_positions(&self) -> usize
fn num_positions(&self) -> usize
The last position. There are num_positions() + 1 cells in a frame,
s_0 through s_N; a path starts at s_0 and has to finish at s_N.
Sourcefn steps_into(&self, frame: Self::Frame<'_>, position: usize) -> [Step; DEGREE]
fn steps_into(&self, frame: Self::Frame<'_>, position: usize) -> [Step; DEGREE]
The DEGREE transitions entering position, best-first.
A transition that does not exist at this cell is Step::ABSENT, and so
is one that would come from before s_0, since the solver indexes
position - advance without checking it.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".