pub struct ShmRefclock { /* private fields */ }Expand description
An attached gpsd shared-memory segment.
Implementations§
Source§impl ShmRefclock
impl ShmRefclock
Sourcepub fn attach(unit: i32) -> Result<ShmRefclock, ClockError>
pub fn attach(unit: i32) -> Result<ShmRefclock, ClockError>
Attach to the segment for unit (0..=3 by convention).
Read-only: a time client has no business writing a producer’s segment, and attaching read-only means a bug here cannot corrupt gpsd’s view.
pub fn unit(&self) -> i32
Sourcepub fn sample(&self) -> Option<RefclockSample>
pub fn sample(&self) -> Option<RefclockSample>
Take a sample, or None if the producer has not published one.
Implements the protocol’s two modes. Mode 1 is the one that matters:
the reader checks count before and after copying and retries if it
changed, because the producer writes the struct without a lock and a
sample torn across that write would be a plausible-looking wrong
time.
Trait Implementations§
Source§impl Drop for ShmRefclock
impl Drop for ShmRefclock
impl Send for ShmRefclock
Auto Trait Implementations§
impl !Sync for ShmRefclock
impl Freeze for ShmRefclock
impl RefUnwindSafe for ShmRefclock
impl Unpin for ShmRefclock
impl UnsafeUnpin for ShmRefclock
impl UnwindSafe for ShmRefclock
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