Skip to content

Add From to easier create the wrapped object #3

@pravic

Description

@pravic

Currently:

#[derive(Debug)]
pub struct PublicStruct {
    inner: DebugIgnore<InnerStructWithLotsOfDebugInfo>,
}

impl PublicStruct {
    pub fn new() -> Self {
        Self {
            inner: DebugIgnore(InnerStructWithLotsOfDebugInfo { field: "field", /* ... */ })
        }
    }
}

If From is implemented, it will allow to call .into(), similar to what Option has:

impl PublicStruct {
    pub fn new() -> Self {
        Self {
-            inner: DebugIgnore(InnerStructWithLotsOfDebugInfo { field: "field", /* ... */ })
+            inner: InnerStructWithLotsOfDebugInfo { field: "field", /* ... */ }.into()
        }
    }
}

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