Struct StrandRef

Source
pub struct StrandRef<'a, StrandLabel, DomainLabel> { /* private fields */ }
Expand description

A pointer to a strand being built, containing a current domain and position.

Implementations§

Source§

impl<'a: 'b, 'b, StrandLabel, DomainLabel> StrandRef<'a, StrandLabel, DomainLabel>

Source

pub fn id(&self) -> StrandId

Retrieve the identity of the strand currently being built.

Source

pub fn design(&mut self) -> &mut Design<StrandLabel, DomainLabel>

Return self.builder

Source

pub fn len(&self) -> usize

Total (current) length of the strand being created. Adding more points will increase the length.

Source

pub fn with_color(self, color: u32) -> Self

Choose a color for this strand.

Source

pub fn with_kelly_color(self, color: usize) -> Self

Choose a color for this strand.

Source

pub fn domains(&self) -> &[Domain<DomainLabel>]

List the current domains of this strand (more domains can be added later).

Source

pub fn domains_mut(&mut self) -> &mut Vec<Domain<DomainLabel>>

Gives a mutable pointer to the vector of domains.

Source

pub fn push_domain(&mut self, domain: Domain<DomainLabel>)

Push a domain onto this strand.

Source

pub fn extend<I: Iterator<Item = Domain<DomainLabel>>>(&mut self, i: I)

Extend this strand with multiple domains.

Source

pub fn with_sequence<I: Into<Cow<'static, str>>>(self, sequence: I) -> Self

Sets the sequence of this strand.

Source

pub fn with_domain_sequence<I: Into<Cow<'static, str>>>( self, sequence: I, ) -> Self

Sets the sequence of this strand.

Source

pub fn to(self, x: isize) -> Self

Move along the helix. This method can be called multiple times consecutively, but the direction of the domain is set only on the first call, subsequent calls only change the 3’ end of the domain (which is the forwardmost point if self.forward is true, and the leftmost point else).

Source

pub fn to_point(self, point: [f32; 3]) -> Self

Equivalent to self.to(nucl) where nucl is the nucleotide that is the closest to the position point.

Source

pub fn pop(self) -> Self

Remove the last domain of the strand.

Source

pub fn rev_to(self, x: isize) -> Self

Change the initial point of the first domain of this strand.

Source

pub fn with_label<L: Into<StrandLabel>>(self, label: L) -> Self

Give a label to this strand.

Source

pub fn with_domain_label<L: Into<DomainLabel>>(self, label: L) -> Self

Give a label to the most recently produced domain on this strand.

Source

pub fn next_domain_to(self, to: isize) -> Self

Finish a domain, and start a new one on the same helix and at the same position.

Source

pub fn cross<H: Into<HelixId>>(self, h: H) -> Self

Move the cursor to a different helix, keeping the same current position along the axis of the helix (most meaningful when the helices are in the same plane).

Source

pub fn cross_to<H: Into<HelixId>>(self, h: H, start: isize) -> Self

Move the cursor to a different helix, at the specified position.

Source

pub fn hflip(self, x: isize) -> Self

Compute the horizontal symmetry of this strand with respect to x-coordinate x.

Source

pub fn vflip<H: Into<HelixId>>(self, y: H) -> Self

Compute the vertical symmetry of this strand with respect to y-coordinate y. Most meaningful in flat designs.

Source

pub fn translate(self, x: isize, y: isize) -> Self

Translate this strand (all domains) to a different position. x is the horizontal translation (along the axis of the helices), and y moves between helices. Most meaningful in a flat, on-grid design.

Source

pub fn cycle(self)

Ends a cyclic strands. Set self.cycle to true and link the end and the start of the strand.

Source

pub fn reverse(self) -> Self

Reverse the direction of this strand.

Auto Trait Implementations§

§

impl<'a, StrandLabel, DomainLabel> Freeze for StrandRef<'a, StrandLabel, DomainLabel>

§

impl<'a, StrandLabel, DomainLabel> RefUnwindSafe for StrandRef<'a, StrandLabel, DomainLabel>
where StrandLabel: RefUnwindSafe, DomainLabel: RefUnwindSafe,

§

impl<'a, StrandLabel, DomainLabel> Send for StrandRef<'a, StrandLabel, DomainLabel>
where StrandLabel: Send, DomainLabel: Send,

§

impl<'a, StrandLabel, DomainLabel> Sync for StrandRef<'a, StrandLabel, DomainLabel>
where StrandLabel: Sync, DomainLabel: Sync,

§

impl<'a, StrandLabel, DomainLabel> Unpin for StrandRef<'a, StrandLabel, DomainLabel>

§

impl<'a, StrandLabel, DomainLabel> !UnwindSafe for StrandRef<'a, StrandLabel, DomainLabel>

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Component + Float, Swp: WhitePoint, Dwp: WhitePoint, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<Swp, Dwp, T>,

Convert the source color to the destination color using the specified method
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.