pub struct Visualizer { /* private fields */ }Expand description
OxiDD-vis-compatible decision diagram exporter that serves decision diagram dumps on localhost via HTTP
OxiDD-vis is a webapp that runs locally in your browser. You can directly
send decision diagrams to it via an HTTP connection. Here, the Visualizer
acts as a small HTTP server that accepts connections once you call
Visualizer::serve(). The webapp repeatedly polls on the configured port
to directly display the decision diagrams then.
Implementations§
Source§impl Visualizer
impl Visualizer
Sourcepub fn port(self, port: u16) -> Self
pub fn port(self, port: u16) -> Self
Customize the port on which to serve the visualization data
The default port is 4000.
Returns self.
Sourcepub fn add<'id, FR: Deref>(
self,
diagram_name: &str,
manager: &<FR::Target as Function>::Manager<'id>,
functions: impl IntoIterator<Item = FR>,
) -> Selfwhere
FR::Target: Function,
INodeOfFunc<'id, FR::Target>: HasLevel,
TermOfFunc<'id, FR::Target>: AsciiDisplay,
pub fn add<'id, FR: Deref>(
self,
diagram_name: &str,
manager: &<FR::Target as Function>::Manager<'id>,
functions: impl IntoIterator<Item = FR>,
) -> Selfwhere
FR::Target: Function,
INodeOfFunc<'id, FR::Target>: HasLevel,
TermOfFunc<'id, FR::Target>: AsciiDisplay,
Add a decision diagram for visualization
diagram_name can be used as an identifier in case you add multiple
diagrams. functions is an iterator over Functions.
The visualization includes all nodes reachable from the root nodes
referenced by functions. If you wish to name the functions, use
Self::add_with_names().
Returns self to allow chaining.
§Example
Visualizer::new()
.add("my_diagram", manager, [f0, f1])
.serve()
.expect("failed to serve diagram due to I/O error")Sourcepub fn add_with_names<'id, FR: Deref, D: Display>(
self,
diagram_name: &str,
manager: &<FR::Target as Function>::Manager<'id>,
functions: impl IntoIterator<Item = (FR, D)>,
) -> Selfwhere
FR::Target: Function,
INodeOfFunc<'id, FR::Target>: HasLevel,
TermOfFunc<'id, FR::Target>: AsciiDisplay,
pub fn add_with_names<'id, FR: Deref, D: Display>(
self,
diagram_name: &str,
manager: &<FR::Target as Function>::Manager<'id>,
functions: impl IntoIterator<Item = (FR, D)>,
) -> Selfwhere
FR::Target: Function,
INodeOfFunc<'id, FR::Target>: HasLevel,
TermOfFunc<'id, FR::Target>: AsciiDisplay,
Add a decision diagram for visualization
diagram_name can be used as an identifier in case you add multiple
diagrams. functions is an iterator over pairs of a Function and
a name.
The visualization includes all nodes reachable from the root nodes
referenced by functions.
Returns self to allow chaining.
§Example
Visualizer::new()
.add_with_names("my_diagram", manager, [(phi, "ϕ"), (res, "result")])
.serve()
.expect("failed to serve diagram due to I/O error")Sourcepub fn serve(&mut self) -> Result<()>
pub fn serve(&mut self) -> Result<()>
Serve the provided decision diagram for visualization
Blocks until the visualization has been fetched by OxiDD-vis (or another compatible tool).
On success, all previously added decision diagrams are removed from the internal buffer. On error, the internal buffer is left as-is.
Sourcepub fn serve_nonblocking(&mut self) -> Result<VisualizationListener<'_>>
pub fn serve_nonblocking(&mut self) -> Result<VisualizationListener<'_>>
Non-blocking version of Self::serve()
Unlike Self::serve(), this method sets the TcpListener into
non-blocking mode, allowing to run
different tasks while waiting for a connection by
OxiDD-vis (or another compatible tool).
Note that you need to call poll()
repeatedly on the returned VisualizationListener to accept a TCP
connection.