Skip to content

Debug implementation for Smartcore structs in notebooks #1

@Mec-iS

Description

@Mec-iS

Common structs should have implemented their own evcxr_display function in Debug trait to be visualized correctly in Notebooks (as HTML).

For example as found here for List:

use std::fmt::Debug;
pub struct List<T>(Vec<T>);
impl<T: Debug> List<T> {
    pub fn evcxr_display(&self) {
        let mut html = String::new();
        
        html.push_str("<ol>");
        
        for item in &self.0 {
            html.push_str(&format!("<li>{:?}</li>", item));
        }
        
        html.push_str("</ol>");
        println!("EVCXR_BEGIN_CONTENT text/html\n{}\nEVCXR_END_CONTENT", html);
    }
}

Different issues for this can be opened in main smartcore repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions