Struct noodles_core::position::Position
source · pub struct Position(/* private fields */);
Expand description
A 1-based position.
Implementations§
source§impl Position
impl Position
sourcepub const fn new(n: usize) -> Option<Self>
pub const fn new(n: usize) -> Option<Self>
Creates a position if the given value is not zero.
§Examples
use noodles_core::Position;
assert!(Position::new(8).is_some());
assert!(Position::new(0).is_none());
sourcepub const fn checked_add(self, other: usize) -> Option<Self>
pub const fn checked_add(self, other: usize) -> Option<Self>
Adds an unsigned integer to a 1-based position.
This returns None
if the operation overflowed.
§Examples
use noodles_core::Position;
let position = Position::try_from(8)?;
assert_eq!(position.checked_add(5), Position::new(13));
Trait Implementations§
source§impl Ord for Position
impl Ord for Position
source§impl PartialEq for Position
impl PartialEq for Position
source§impl PartialOrd for Position
impl PartialOrd for Position
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl RangeBounds<Position> for Interval
impl RangeBounds<Position> for Interval
source§impl<T> SequenceIndex<T> for Position
impl<T> SequenceIndex<T> for Position
source§fn get(self, sequence: &[T]) -> Option<&Self::Output>
fn get(self, sequence: &[T]) -> Option<&Self::Output>
Returns a reference to the output of the given index.
source§fn get_mut(self, sequence: &mut [T]) -> Option<&mut Self::Output>
fn get_mut(self, sequence: &mut [T]) -> Option<&mut Self::Output>
Returns a mutable reference to the output of the given index.
impl Copy for Position
impl Eq for Position
impl StructuralPartialEq for Position
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnwindSafe for Position
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