Skip to main content

rdi_core/
snapshot.rs

1//! Immutable snapshot of a single desktop icon's observable state.
2
3use std::path::PathBuf;
4
5use crate::{IconId, Point};
6
7/// Everything the enumeration layer knows about one desktop icon at the
8/// moment the snapshot was taken.
9///
10/// `path` is `None` for virtual items (e.g. *This PC*, *Recycle Bin*).
11#[derive(Clone, Debug, PartialEq, Eq)]
12pub struct IconSnapshot {
13    pub id: IconId,
14    pub display_name: String,
15    pub path: Option<PathBuf>,
16    pub is_virtual: bool,
17    pub position: Point,
18}
19
20impl IconSnapshot {
21    #[inline]
22    pub fn new(
23        id: IconId,
24        display_name: impl Into<String>,
25        path: Option<PathBuf>,
26        is_virtual: bool,
27        position: Point,
28    ) -> Self {
29        Self {
30            id,
31            display_name: display_name.into(),
32            path,
33            is_virtual,
34            position,
35        }
36    }
37}