Skip to main content

SessionFile

Struct SessionFile 

Source
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>§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

Source

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.

Source

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.

Source

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.

Source

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

Source

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

Source§

fn clone(&self) -> SessionFile

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 Debug for SessionFile

Source§

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

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

impl<'de> Deserialize<'de> for SessionFile

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for SessionFile

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for SessionFile

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SessionFile

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.