Skip to main content

VesselState

Struct VesselState 

Source
pub struct VesselState {
    pub position: Position,
    pub cog_deg: f64,
    pub sog_kn: f64,
    pub heading_deg: Option<f64>,
}
Expand description

What a client knows about own ship at one instant.

Fields§

§position: Position

Where the vessel is.

§cog_deg: f64

Course over ground, degrees true.

§sog_kn: f64

Speed over ground, knots.

§heading_deg: Option<f64>

Heading, degrees true, when the vessel has a compass.

Differs from course when there is leeway or current. None when the vessel has no heading sensor; substituting course in that case would misrepresent a measurement as heading.

Implementations§

Source§

impl VesselState

Source

pub fn predictor_end(&self) -> Position

The far end of the course predictor: where the vessel reaches if it holds this course and speed for PREDICTOR_MINUTES.

Source

pub fn heading_line_end(&self) -> Option<Position>

The far end of the heading line: where the bow points, which differs from the course over ground under leeway or current.

Length matches the course predictor so the angle between them is directly comparable, with a floor (MIN_HEADING_LINE_NM) so the line stays visible for a vessel stopped in a tideway. None when there is no compass; no line is drawn in that case.

Trait Implementations§

Source§

impl Clone for VesselState

Source§

fn clone(&self) -> VesselState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for VesselState

Source§

impl Debug for VesselState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for VesselState

Source§

fn eq(&self, other: &VesselState) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for VesselState

Auto Trait Implementations§

Blanket Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.