Skip to main content

Session

Struct Session 

Source
pub struct Session {
    pub(crate) handle: NonNull<SvzSession>,
}
Expand description

One opened log: its catalog, the view state, the transforms, and what the plot and readout show.

Fields§

§handle: NonNull<SvzSession>

The C handle; never null.

Implementations§

Source§

impl Session

Source

pub fn new() -> Result<Self, Error>

A session with no log.

§Errors

Error::AbiMismatch for a library of another interface version, Error::OutOfMemory when it cannot allocate.

Source

pub(crate) fn raw(&self) -> *mut SvzSession

The handle, for a call.

Source

pub(crate) fn last_error(&self) -> Error

The library’s last error on this session.

Source

pub(crate) fn returned(&mut self, text: *const c_char) -> String

Copies a string the library returned for this session.

Source

pub fn open( &mut self, path: impl AsRef<Path>, preferences: Option<&Preferences>, ) -> Result<(), Error>

Opens a log and does everything sensorViz’s File > Load does: reads it, resets the view, runs the transforms and applies preferences’ entry for its tag.

§Errors

Error::Library when the log cannot be read, leaving the session as it was; Error::Nul when the path holds a NUL.

Source

pub fn apply_preferences(&mut self, preferences: &Preferences) -> Changes

Applies preferences’ entry for the open log’s tag, or the defaults.

Source

pub fn remember_preferences(&self, preferences: &mut Preferences)

Stores the open log’s display choices in preferences under its tag.

Source

pub fn forget_preferences(&self, preferences: &mut Preferences)

Removes preferences’ entry for the open log’s tag.

Source

pub fn catalog(&mut self) -> Result<Catalog, Error>

The open log.

§Errors

Error::Json for JSON this crate does not understand.

Source

pub fn view(&mut self) -> Result<View, Error>

The view state.

§Errors

Error::Json for JSON this crate does not understand.

Source

pub fn spec(&mut self) -> Result<Spec, Error>

The plot spec.

§Errors

Error::Json for JSON this crate does not understand.

Source

pub fn state_json(&mut self) -> [String; 3]

The JSON texts of the catalog, view and spec, as the library writes them: for comparing two sessions exactly.

Source

pub fn parameters(&mut self) -> Result<Vec<Parameter>, Error>

The parameters of the transforms that apply to the open log, with their current values.

§Errors

Error::Json for JSON this crate does not understand.

Source

pub fn hover(&mut self, time: f64) -> Result<Vec<String>, Error>

The hover readout at time: the time, then each visible stream’s label: value units.

§Errors

Error::Json for JSON this crate does not understand.

Source

pub fn format_time(&mut self, time: f64) -> String

time as the readout shows it.

Source

pub fn range_for_dialog(&self, id: &str) -> Option<(f64, f64)>

The range the range dialog starts from for stream id; None for an unknown stream.

Source

pub fn envelope( &mut self, stream: u64, t0: f64, t1: f64, columns: i32, break_gaps: bool, ) -> Envelope

One stream’s M4 envelope over [t0, t1] (infinities for the whole stream) at columns, breaking lines at gaps when break_gaps.

Source

pub fn compass_samples(&mut self) -> Vec<OrientationSample>

The compass orientation samples; empty without a compass.

Source

pub fn state_dump(&mut self) -> String

Takes the open log through sensorViz’s state-dump script and returns the dump; it changes the session, so use one opened for the purpose.

Source

pub fn set_stream_visible(&mut self, id: &str, visible: bool) -> Changes

Shows or hides stream id.

Source

pub fn set_visible_streams(&mut self, ids: &[&str]) -> Result<Changes, Error>

Shows exactly the streams ids.

§Errors

Error::Nul when an id holds a NUL.

Source

pub fn set_stream_range(&mut self, id: &str, lower: f64, upper: f64) -> Changes

Sets a y range the user chose, and the ranges linked to it.

Source

pub fn reset_zoom(&mut self) -> Changes

Reset Zoom: clears every custom range.

Source

pub fn set_colors(&mut self, colors: &[(&str, u32)]) -> Result<Changes, Error>

Replaces the color overrides: stream id and 0xRRGGBB.

§Errors

Error::Nul when an id holds a NUL.

Source

pub fn set_axis_sides( &mut self, sides: &[(&str, Side)], ) -> Result<Changes, Error>

Replaces the axis-side overrides.

§Errors

Error::Nul when an id holds a NUL.

Source

pub fn set_title(&mut self, title: &str) -> Result<Changes, Error>

Sets the title text.

§Errors

Error::Nul when the title holds a NUL.

Source

pub fn set_title_visible(&mut self, visible: bool) -> Changes

Shows or hides the title.

Source

pub fn set_utc_offset(&mut self, hours: i32) -> Changes

Sets the UTC offset for epoch times, hours.

Source

pub fn set_cursors_visible(&mut self, visible: bool) -> Changes

Shows or hides the time cursors.

Source

pub fn set_break_at_gaps(&mut self, break_gaps: bool) -> Changes

Breaks lines at gaps, or joins them.

Source

pub fn set_parameter(&mut self, id: &str, value: f64) -> Result<Changes, Error>

Sets a transform parameter (an id from Session::parameters) and remakes what it affects; a toggle is on when value is nonzero.

§Errors

Error::Library when the transform failed to remake its outputs; Error::Nul when the id holds a NUL.

Trait Implementations§

Source§

impl Drop for Session

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for Session

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> 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, 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.