Skip to content

Commit

Permalink
Clarify validity invariants
Browse files Browse the repository at this point in the history
  • Loading branch information
MolotovCherry committed Dec 5, 2023
1 parent 04ccf26 commit aa71e1a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion virtual-display-driver/src/ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ fn get_data() -> Vec<Monitor> {
.unwrap_or_default()
}

/// used by notify to check the validity of a Vec<Monitor>
/// used to check the validity of a Vec<Monitor>
/// the validity invariants are:
/// 1. unique monitor ids
/// 2. unique monitor modes (width+height must be unique per array element)
/// 3. unique refresh rates per monitor mode
fn has_duplicates(monitors: &[Monitor]) -> bool {
let mut monitor_iter = monitors.iter();
while let Some(monitor) = monitor_iter.next() {
Expand Down

0 comments on commit aa71e1a

Please sign in to comment.