paint_api/
largest_contentful_paint_candidate.rs1use base::cross_process_instant::CrossProcessInstant;
8use serde::{Deserialize, Serialize};
9
10#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
12pub struct LCPCandidate {
13 pub id: LCPCandidateID,
15 pub area: usize,
17}
18
19impl LCPCandidate {
20 pub fn new(id: LCPCandidateID, area: usize) -> Self {
21 Self { id, area }
22 }
23}
24
25#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
26pub struct LCPCandidateID(pub usize);
27
28#[derive(Clone, Copy, Debug)]
29pub struct LargestContentfulPaint {
30 pub id: LCPCandidateID,
31 pub area: usize,
32 pub paint_time: CrossProcessInstant,
33}
34
35impl LargestContentfulPaint {
36 pub fn from(lcp_candidate: LCPCandidate, paint_time: CrossProcessInstant) -> Self {
37 Self {
38 id: lcp_candidate.id,
39 area: lcp_candidate.area,
40 paint_time,
41 }
42 }
43}