pub struct PhysicsStreamClient {
pub port: u16,
pub connected: bool,
pub frames: VecDeque<ProtocolFrame>,
pub protocol: BinaryProtocol,
pub latest_state: Vec<f64>,
pub prev_state: Vec<f64>,
}Expand description
Mock physics stream client.
Connects to a mock server, receives frames, decodes, and interpolates.
Fields§
§port: u16Server port.
connected: boolConnected flag.
frames: VecDeque<ProtocolFrame>Received frames buffer.
protocol: BinaryProtocolProtocol decoder.
latest_state: Vec<f64>Latest decoded state.
prev_state: Vec<f64>Previous state for interpolation.
Implementations§
Source§impl PhysicsStreamClient
impl PhysicsStreamClient
Sourcepub fn disconnect(&mut self)
pub fn disconnect(&mut self)
Disconnect.
Sourcepub fn receive_frame(&mut self, frame: ProtocolFrame)
pub fn receive_frame(&mut self, frame: ProtocolFrame)
Inject a frame (from server).
Sourcepub fn decode_latest(&mut self)
pub fn decode_latest(&mut self)
Decode the latest frame.
Sourcepub fn interpolated_state(&self, t: f64) -> Vec<f64>
pub fn interpolated_state(&self, t: f64) -> Vec<f64>
Get interpolated state at t in [0, 1].
Sourcepub fn buffered_frames(&self) -> usize
pub fn buffered_frames(&self) -> usize
Number of buffered frames.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PhysicsStreamClient
impl RefUnwindSafe for PhysicsStreamClient
impl Send for PhysicsStreamClient
impl Sync for PhysicsStreamClient
impl Unpin for PhysicsStreamClient
impl UnsafeUnpin for PhysicsStreamClient
impl UnwindSafe for PhysicsStreamClient
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
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.