Struct bellframe::block::AnnotBlock [−][src]
pub struct AnnotBlock<A> { /* fields omitted */ }
Expand description
An AnnotBlock
is in essence a multi-permutation: it describes the transposition of a single
start Row
into many Row
s, the first of which is always the one supplied. The last
Row
of an AnnotBlock
is considered ‘left-over’, and represents the first Row
that
should be rung after this AnnotBlock
.
A few things to note about Block
s:
- All
Block
s must have non-zero length. Zero-length blocks cannot be created withsafe
code, and will cause undefined behaviour orpanic!
s.
Implementations
Parse a multi-line str
ing into an unannotated Block
. The last Row
parsed will be
considered ‘left over’ - i.e. it isn’t directly part of this Block
but rather will be the
first Row
of any Block
which gets appended to this one. Each Row
has the default
annotation (thus requiring that A
implements Default
).
Creates an empty AnnotBlock
on a given Stage
(i.e. an AnnotBlock
containing only
rounds as the leftover row). This function is wildly unsafe; it should only be used if
you are going to extend the block before passing it out of the unsafe
boundary.
Safety
This function is never safe on its own. In order to make the result safe, you have to
push more AnnotRow
s onto the AnnotBlock
(using AnnotBlock::extend_with
,
AnnotBlock::extend_from_iter_transposed
, etc.).
Gets the Row
at a given index, along with its annotation.
Gets an immutable reference to the annotation of the Row
at a given index, if it
exists.
Gets an mutable reference to the annotation of the Row
at a given index, if it
exists.
Gets the Row
at a given index, along with its annotation.
Gets the first Row
of this AnnotBlock
, along with its annotation.
Gets the length of this Block
(excluding the left-over Row
). This is guarunteed to
be at least 1.
Returns an Iterator
over all the annotations in this Block
.
Returns an Iterator
yielding mutable references to the annotations in this Block
.
Returns a mutable reference to the annotation of the ‘left-over’ Row
of this Block
.
Convert this AnnotBlock
into another AnnotBlock
with identical Row
s, but where each
annotation is passed through the given function.
Convert this AnnotBlock
into another AnnotBlock
with identical Row
s, but where each
annotation is passed through the given function.
Convert this AnnotBlock
into another AnnotBlock
with identical Row
s, but where each
annotation is passed through the given function.
Splits this AnnotBlock
into two separate AnnotBlock
s at a specified index. This makes
self
shorter, whilst returning the remainder as a new AnnotBlock
(along with its first
Row
). This returns None
without mutation if either of the blocks would have zero
length. During the course of this, the row at the split point will be used twice so the
annotation is moved to the second block (and the leftover row of self
is annotated with
a default value).
pub fn extend_from_iter_transposed(
&mut self,
annot_rows: impl IntoIterator<Item = AnnotRow<A>>
) -> Result<(), IncompatibleStages>
[src]
pub fn extend_from_iter_transposed(
&mut self,
annot_rows: impl IntoIterator<Item = AnnotRow<A>>
) -> Result<(), IncompatibleStages>
[src]pub fn extend_with_cloned(
&mut self,
other: &Self
) -> Result<(), IncompatibleStages> where
A: Clone,
[src]
pub fn extend_with_cloned(
&mut self,
other: &Self
) -> Result<(), IncompatibleStages> where
A: Clone,
[src]Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<A> RefUnwindSafe for AnnotBlock<A> where
A: RefUnwindSafe,
impl<A> Send for AnnotBlock<A> where
A: Send,
impl<A> Sync for AnnotBlock<A> where
A: Sync,
impl<A> Unpin for AnnotBlock<A> where
A: Unpin,
impl<A> UnwindSafe for AnnotBlock<A> where
A: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more