pub struct SessionFile {
pub schema: u32,
pub app: AppInfo,
pub created_utc: String,
pub platform: Option<String>,
pub capture: Option<CaptureKind>,
pub name: Option<String>,
pub monitors: Vec<MonitorRecord>,
pub target: Option<TargetRecord>,
pub selections: Vec<SelectionRecord>,
pub measures: Vec<MeasureRecord>,
}Fields§
§schema: u32§app: AppInfo§created_utc: String§platform: Option<String>The OS the session was captured on — what a consumer needs to know
before re-attaching to the recorded window or coordinates:
macos, windows, linux-x11, or linux-wayland.
capture: Option<CaptureKind>See CaptureKind.
name: Option<String>A human-friendly session name (“microsoft teams”) for pickers and listings; the folder name identifies, this describes.
monitors: Vec<MonitorRecord>§target: Option<TargetRecord>Present when the session was captured with --target: the matched
window’s identity and bounds at freeze time.
selections: Vec<SelectionRecord>§measures: Vec<MeasureRecord>Two-point measurements, when any were taken. A separate top-level
array rather than a shape kind: a measure has no interior, so
every consumer of selections would have to special-case one.
Additive and omitted when empty, so the schema does not move and
sessions without measures look exactly as they always did.
Implementations§
Source§impl SessionFile
impl SessionFile
Sourcepub fn build(
app_version: &str,
created_utc: String,
monitors: Vec<MonitorRecord>,
selections: &[Selection],
crops: &[String],
target: Option<TargetRecord>,
) -> Self
pub fn build( app_version: &str, created_utc: String, monitors: Vec<MonitorRecord>, selections: &[Selection], crops: &[String], target: Option<TargetRecord>, ) -> Self
Assemble a session. created_utc is supplied by the caller (this
crate has no clock); crops pairs 1:1 with selections.
Sourcepub fn with_meta(
self,
platform: Option<String>,
capture: Option<CaptureKind>,
name: Option<String>,
) -> Self
pub fn with_meta( self, platform: Option<String>, capture: Option<CaptureKind>, name: Option<String>, ) -> Self
Stamp provenance onto a built session. A resumed session passes through what it loaded, so a file edited on another machine keeps saying where it was captured.
Sourcepub fn with_measures(self, measures: &[Measure]) -> Self
pub fn with_measures(self, measures: &[Measure]) -> Self
Attach the session’s measurements, converting each to global coordinates through its own monitor’s origin and precomputing the derived values.
A builder rather than an argument to build for the same reason
the colors are: a session without measures is an ordinary session,
so it cannot be required of every caller.
Sourcepub fn with_colors(self, colors: &[Option<String>]) -> Self
pub fn with_colors(self, colors: &[Option<String>]) -> Self
Attach the sampled click-point color to each selection, in the
same order Self::build took them.
Separate from build because the color comes from the frozen
frames, which only the caller holds — and because a session
without colors is a valid session, so this cannot be a required
argument. A shorter slice leaves the rest without a color rather
than shifting them onto the wrong selection.
Source§impl SessionFile
impl SessionFile
Sourcepub fn validate(&self) -> Result<(), SessionError>
pub fn validate(&self) -> Result<(), SessionError>
Check that a parsed session describes something a coordinate can mean.
Called at the load seam so every command and doctor refuse the
same file, the way Config’s resolution is checked once when the
config is read rather than at each use. A file that fails here is
malformed, not merely unusual, and the caller reports it as such.
Trait Implementations§
Source§impl Clone for SessionFile
impl Clone for SessionFile
Source§fn clone(&self) -> SessionFile
fn clone(&self) -> SessionFile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more