pub struct LineSegment { /* private fields */ }Expand description
Describes a constant contribution spanning an inclusive set of one-based line numbers.
Implementations§
Source§impl LineSegment
impl LineSegment
Sourcepub fn new(
start_line: usize,
end_line: usize,
value: f64,
) -> Result<Self, SegmentError>
pub fn new( start_line: usize, end_line: usize, value: f64, ) -> Result<Self, SegmentError>
Creates a new line segment.
Line numbers are one-based and ranges are inclusive.
§Examples
use whitaker_common::complexity_signal::LineSegment;
let segment = LineSegment::new(3, 5, 1.25).expect("segment should be valid");
assert_eq!(segment.start_line(), 3);
assert_eq!(segment.end_line(), 5);Sourcepub const fn start_line(self) -> usize
pub const fn start_line(self) -> usize
Returns the first line covered by the segment (inclusive).
Trait Implementations§
Source§impl Clone for LineSegment
impl Clone for LineSegment
Source§fn clone(&self) -> LineSegment
fn clone(&self) -> LineSegment
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for LineSegment
Source§impl Debug for LineSegment
impl Debug for LineSegment
Source§impl PartialEq for LineSegment
impl PartialEq for LineSegment
impl StructuralPartialEq for LineSegment
Auto Trait Implementations§
impl Freeze for LineSegment
impl RefUnwindSafe for LineSegment
impl Send for LineSegment
impl Sync for LineSegment
impl Unpin for LineSegment
impl UnsafeUnpin for LineSegment
impl UnwindSafe for LineSegment
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