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 Rows, 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 Blocks:

  • All Blocks must have non-zero length. Zero-length blocks cannot be created with safe code, and will cause undefined behaviour or panic!s.

Implementations

Parse a multi-line string 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 a new AnnotBlock from a Vec of annotated Rows, checking that the result is valid.

Creates a new AnnotBlock from a Vec of annotated Rows, without performing any safety checks.

Safety

This is safe when the following properties hold:

  • rows has length at least 2. This is so that there is at least one Row in the AnnotBlock, plus one leftover Row.
  • All the rows have the same Stage.

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 AnnotRows onto the AnnotBlock (using AnnotBlock::extend_with, AnnotBlock::extend_from_iter_transposed, etc.).

Gets the Stage of this Block.

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 Rows in this AnnotBlock, along with their annotations.

Returns an immutable reference to the slice of annotated Rows making up this Block

Returns an Iterator over all the Rows in this Block, without their annotations.

Returns an Iterator over all the annotations in this Block.

Returns an Iterator yielding mutable references to the annotations in this Block.

Pre-multiplies every Row in this Block by another Row. The resulting Block is equivalent to self (inasmuch as the relations between the Rows are identical), but it will start from a different Row.

Returns the ‘left-over’ Row of this Block, along with its annotation. This Row represents the overall transposition of the Block, and should not be used when generating rows for truth checking.

Returns the ‘left-over’ Row of this Block. This Row represents the overall transposition of the Block, and should not be used when generating rows for truth checking.

Returns a mutable reference to the annotation of the ‘left-over’ Row of this Block.

Convert this AnnotBlock into another AnnotBlock with identical Rows, but where each annotation is passed through the given function.

Convert this AnnotBlock into another AnnotBlock with identical Rows, but where each annotation is passed through the given function.

Convert this AnnotBlock into another AnnotBlock with identical Rows, but where each annotation is passed through the given function.

Splits this AnnotBlock into two separate AnnotBlocks 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).

Extend this AnnotBlock with AnnotRows generated by a given Iterator, transposing them so that the first new Row matches self.leftover_row().

Extend this AnnotBlock with the contents of another AnnotBlock. This modifies self to have the effect of ringing self then other. Note that this overwrites the leftover Row of self, replacing its annotation with that of other’s first Row.

Extend this AnnotBlock with the contents of another AnnotBlock, cloning the annotations. This modifies self to have the effect of ringing self then other. Note that this overwrites the leftover Row of self, replacing its annotation with that of other’s first Row.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.