Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl From for MessageField for convenience #693

Closed
wants to merge 1 commit into from

Conversation

jkalez
Copy link

@jkalez jkalez commented Dec 13, 2023

I have found that constructing various messages often leads to creating MessageField types explicitly. For example, the following struct may be generated:

struct MyStruct {
    pub some_field: MessageField<MyOtherStruct>,
    ...
    pub special_fields: SpecialFields
}

I often initialize this as follows:

let s =  MyStruct {
    some_field: MessageField::some(MyOtherStruct { <blah> }),
   ...
};

This PR would allow users to use the blanket provided implementation of Into by deriving From, enabling this simpler syntax:

let s =  MyStruct {
    some_field: MyOtherStruct { <blah> }.into(),
    ...
};

@stepancheg
Copy link
Owner

This PR adds code commented out.

@stepancheg
Copy link
Owner

Closing this PR, please reopen if this change is still needed and PR is fixed.

@stepancheg stepancheg closed this Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants