pub struct Position<S: System> { /* private fields */ }Expand description
An offset from the start of a molecule.
For a more in-depth discussion on what positions are and the notations used within this crate, please see this section of the docs.
Implementations§
Source§impl<S: System> Position<S>
impl<S: System> Position<S>
Sourcepub fn get(&self) -> Number
pub fn get(&self) -> Number
Gets the numerical position.
§Examples
use omics_coordinate::Position;
use omics_coordinate::system::Interbase;
let position = Position::<Interbase>::new(42);
assert_eq!(position.get(), 42);Sourcepub fn checked_add(&self, rhs: Number) -> Option<Self>where
Self: Position<S>,
pub fn checked_add(&self, rhs: Number) -> Option<Self>where
Self: Position<S>,
Performs checked addition.
§Examples
use omics_coordinate::Position;
use omics_coordinate::system::Interbase;
let position = Position::<Interbase>::new(42)
.checked_add(8)
.expect("addition to succeed");
assert_eq!(position.get(), 50);Sourcepub fn checked_sub(&self, rhs: Number) -> Option<Self>where
Self: Position<S>,
pub fn checked_sub(&self, rhs: Number) -> Option<Self>where
Self: Position<S>,
Performs checked subtraction.
§Examples
use omics_coordinate::Position;
use omics_coordinate::system::Interbase;
let position = Position::<Interbase>::new(42)
.checked_sub(2)
.expect("subtraction to succeed");
assert_eq!(position.get(), 40);Trait Implementations§
Source§impl<S: Ord + System> Ord for Position<S>
impl<S: Ord + System> Ord for Position<S>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<S: PartialOrd + System> PartialOrd for Position<S>
impl<S: PartialOrd + System> PartialOrd for Position<S>
impl<S: Copy + System> Copy for Position<S>
impl<S: Eq + System> Eq for Position<S>
impl<S: System> StructuralPartialEq for Position<S>
Auto Trait Implementations§
impl<S> Freeze for Position<S>where
S: Freeze,
impl<S> RefUnwindSafe for Position<S>where
S: RefUnwindSafe,
impl<S> Send for Position<S>where
S: Send,
impl<S> Sync for Position<S>where
S: Sync,
impl<S> Unpin for Position<S>where
S: Unpin,
impl<S> UnwindSafe for Position<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more