Skip to main content

DiagnosticsSerializationDelegate

Trait DiagnosticsSerializationDelegate 

Source
pub trait DiagnosticsSerializationDelegate {
    // Required methods
    fn additional_node_properties(
        &self,
        node: &dyn DiagnosticsNode,
        full_details: bool,
    ) -> Map<String, Value>;
    fn filter_children(
        &self,
        nodes: Vec<Rc<dyn DiagnosticsNode>>,
        owner: &dyn DiagnosticsNode,
    ) -> Vec<Rc<dyn DiagnosticsNode>>;
    fn filter_properties(
        &self,
        nodes: Vec<Rc<dyn DiagnosticsNode>>,
        owner: &dyn DiagnosticsNode,
    ) -> Vec<Rc<dyn DiagnosticsNode>>;
    fn truncate_nodes_list(
        &self,
        nodes: Vec<Rc<dyn DiagnosticsNode>>,
        owner: Option<&dyn DiagnosticsNode>,
    ) -> Vec<Rc<dyn DiagnosticsNode>>;
    fn delegate_for_node(
        &self,
        node: &dyn DiagnosticsNode,
    ) -> Rc<dyn DiagnosticsSerializationDelegate>;
    fn subtree_depth(&self) -> i32;
    fn include_properties(&self) -> bool;
    fn expand_property_values(&self) -> bool;
    fn copy_with(
        &self,
        subtree_depth: Option<i32>,
        include_properties: Option<bool>,
    ) -> Rc<dyn DiagnosticsSerializationDelegate>;
}
Expand description

A delegate that configures how a hierarchy of DiagnosticsNodes should be serialized.

Dart’s DiagnosticsSerializationDelegate; implement it to configure how nodes serialize, and DefaultDiagnosticsSerializationDelegate for Dart’s DiagnosticsSerializationDelegate factory.

A method that returns a delegate answers an owned one because Rust cannot return this from &self; the default delegate’s copies are values, so returning one is indistinguishable.

Required Methods§

Source

fn additional_node_properties( &self, node: &dyn DiagnosticsNode, full_details: bool, ) -> Map<String, Value>

Returns a serializable map of additional information that will be included in the serialization of the given DiagnosticsNode.

This method is called for every DiagnosticsNode that’s included in the serialization.

Source

fn filter_children( &self, nodes: Vec<Rc<dyn DiagnosticsNode>>, owner: &dyn DiagnosticsNode, ) -> Vec<Rc<dyn DiagnosticsNode>>

Filters the list of DiagnosticsNodes that will be included as children for the given owner node.

The callback may return a subset of the children in the provided list or replace the entire list with new child nodes.

Source

fn filter_properties( &self, nodes: Vec<Rc<dyn DiagnosticsNode>>, owner: &dyn DiagnosticsNode, ) -> Vec<Rc<dyn DiagnosticsNode>>

Filters the list of DiagnosticsNodes that will be included as properties for the given owner node.

The callback may return a subset of the properties in the provided list or replace the entire list with new property nodes.

Source

fn truncate_nodes_list( &self, nodes: Vec<Rc<dyn DiagnosticsNode>>, owner: Option<&dyn DiagnosticsNode>, ) -> Vec<Rc<dyn DiagnosticsNode>>

Truncates the given list of DiagnosticsNode that will be added to the serialization as children or properties of the owner node.

The method must return a subset of the provided nodes and may not replace any nodes. Truncating leaves a hint in the serialization that there were additional nodes.

Source

fn delegate_for_node( &self, node: &dyn DiagnosticsNode, ) -> Rc<dyn DiagnosticsSerializationDelegate>

Returns the delegate to be used for adding the provided DiagnosticsNode to the serialization.

By default, this returns a copy of this delegate with subtree_depth reduced by one.

Source

fn subtree_depth(&self) -> i32

Controls how many levels of children will be included in the serialized hierarchy.

Source

fn include_properties(&self) -> bool

Whether to include the properties of a DiagnosticsNode in the serialization.

Source

fn expand_property_values(&self) -> bool

Whether properties that have a Diagnosticable as value should be expanded.

Source

fn copy_with( &self, subtree_depth: Option<i32>, include_properties: Option<bool>, ) -> Rc<dyn DiagnosticsSerializationDelegate>

Creates a copy of this delegate with the provided values.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§