js-protocol 0.1.0

Generated Rust types for js_protocol.json
Documentation
use serde::{Serialize, Deserialize};

/// Heap snapshot object id.

pub type HeapSnapshotObjectId = String;

/// Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SamplingHeapProfileNode {
    /// Function location.

    pub callFrame: crate::runtime::CallFrame,
    /// Allocations size in bytes for the node excluding children.

    pub selfSize: f64,
    /// Node id. Ids are unique across all profiles collected between startSampling and stopSampling.

    pub id: u64,
    /// Child nodes.

    pub children: Vec<SamplingHeapProfileNode>,
}

/// A single sample from a sampling profile.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SamplingHeapProfileSample {
    /// Allocation size in bytes attributed to the sample.

    pub size: f64,
    /// Id of the corresponding profile tree node.

    pub nodeId: u64,
    /// Time-ordered sample ordinal number. It is unique across all profiles retrieved
    /// between startSampling and stopSampling.

    pub ordinal: f64,
}

/// Sampling profile.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SamplingHeapProfile {

    pub head: SamplingHeapProfileNode,

    pub samples: Vec<SamplingHeapProfileSample>,
}

/// Enables console to refer to the node with given id via $x (see Command Line API for more details
/// $x functions).

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct AddInspectedHeapObjectParams {
    /// Heap snapshot object id to be accessible by means of $x command line API.

    pub heapObjectId: HeapSnapshotObjectId,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetHeapObjectIdParams {
    /// Identifier of the object to get heap object id for.

    pub objectId: crate::runtime::RemoteObjectId,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetHeapObjectIdReturns {
    /// Id of the heap snapshot object corresponding to the passed remote object id.

    pub heapSnapshotObjectId: HeapSnapshotObjectId,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetObjectByHeapObjectIdParams {

    pub objectId: HeapSnapshotObjectId,
    /// Symbolic group name that can be used to release multiple objects.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub objectGroup: Option<String>,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetObjectByHeapObjectIdReturns {
    /// Evaluation result.

    pub result: crate::runtime::RemoteObject,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetSamplingProfileReturns {
    /// Return the sampling profile being collected.

    pub profile: SamplingHeapProfile,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct StartSamplingParams {
    /// Average sample interval in bytes. Poisson distribution is used for the intervals. The
    /// default value is 32768 bytes.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub samplingInterval: Option<f64>,
    /// Maximum stack depth. The default value is 128.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub stackDepth: Option<f64>,
    /// By default, the sampling heap profiler reports only objects which are
    /// still alive when the profile is returned via getSamplingProfile or
    /// stopSampling, which is useful for determining what functions contribute
    /// the most to steady-state memory usage. This flag instructs the sampling
    /// heap profiler to also include information about objects discarded by
    /// major GC, which will show which functions cause large temporary memory
    /// usage or long GC pauses.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub includeObjectsCollectedByMajorGC: Option<bool>,
    /// By default, the sampling heap profiler reports only objects which are
    /// still alive when the profile is returned via getSamplingProfile or
    /// stopSampling, which is useful for determining what functions contribute
    /// the most to steady-state memory usage. This flag instructs the sampling
    /// heap profiler to also include information about objects discarded by
    /// minor GC, which is useful when tuning a latency-sensitive application
    /// for minimal GC activity.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub includeObjectsCollectedByMinorGC: Option<bool>,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct StartTrackingHeapObjectsParams {

    #[serde(skip_serializing_if = "Option::is_none")]
    pub trackAllocations: Option<bool>,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct StopSamplingReturns {
    /// Recorded sampling heap profile.

    pub profile: SamplingHeapProfile,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct StopTrackingHeapObjectsParams {
    /// If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken
    /// when the tracking is stopped.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub reportProgress: Option<bool>,
    /// Deprecated in favor of 'exposeInternals'.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub treatGlobalObjectsAsRoots: Option<bool>,
    /// If true, numerical values are included in the snapshot

    #[serde(skip_serializing_if = "Option::is_none")]
    pub captureNumericValue: Option<bool>,
    /// If true, exposes internals of the snapshot.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub exposeInternals: Option<bool>,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct TakeHeapSnapshotParams {
    /// If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub reportProgress: Option<bool>,
    /// If true, a raw snapshot without artificial roots will be generated.
    /// Deprecated in favor of 'exposeInternals'.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub treatGlobalObjectsAsRoots: Option<bool>,
    /// If true, numerical values are included in the snapshot

    #[serde(skip_serializing_if = "Option::is_none")]
    pub captureNumericValue: Option<bool>,
    /// If true, exposes internals of the snapshot.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub exposeInternals: Option<bool>,
}