use crate::protocol::types::{JsUInt, ScriptId};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct CoverageRange {
pub start_offset: JsUInt,
pub end_offset: JsUInt,
pub count: JsUInt,
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct FunctionCoverage {
pub function_name: String,
pub ranges: Vec<CoverageRange>,
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct ScriptCoverage {
pub script_id: ScriptId,
pub url: String,
pub functions: Vec<FunctionCoverage>,
}
pub mod methods {
use serde::{Deserialize, Serialize};
use crate::protocol::Method;
#[derive(Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Enable {}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EnableReturnObject {}
impl Method for Enable {
const NAME: &'static str = "Profiler.enable";
type ReturnObject = EnableReturnObject;
}
#[derive(Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Disable {}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DisableReturnObject {}
impl Method for Disable {
const NAME: &'static str = "Profiler.disable";
type ReturnObject = DisableReturnObject;
}
#[derive(Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct StartPreciseCoverage {
#[serde(skip_serializing_if = "Option::is_none")]
pub call_count: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub detailed: Option<bool>,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct StartPreciseCoverageReturnObject {}
impl Method for StartPreciseCoverage {
const NAME: &'static str = "Profiler.startPreciseCoverage";
type ReturnObject = StartPreciseCoverageReturnObject;
}
#[derive(Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct StopPreciseCoverage {}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct StopPreciseCoverageReturnObject {}
impl Method for StopPreciseCoverage {
const NAME: &'static str = "Profiler.stopPreciseCoverage";
type ReturnObject = StopPreciseCoverageReturnObject;
}
#[derive(Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct TakePreciseCoverage {}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TakePreciseCoverageReturnObject {
pub result: Vec<super::ScriptCoverage>,
}
impl Method for TakePreciseCoverage {
const NAME: &'static str = "Profiler.takePreciseCoverage";
type ReturnObject = TakePreciseCoverageReturnObject;
}
}