Skip to content

Should we have FromVarULE? #1180

@sffc

Description

@sffc

Part of #1082

Split from #1179

If we want to support cases where the target type borrows from the VarULE, FromVarULE can work (playground):

trait FromVarULE<'a, U: ?Sized>: 'a {
    fn from_var_ule(ule: &'a U) -> Self;
}

impl FromVarULE<'_, str> for String {
    fn from_var_ule(ule: &str) -> Self {
        ule.to_string()
    }
}

impl<'a> FromVarULE<'a, str> for Cow<'a, str> {
    fn from_var_ule(ule: &'a str) -> Self {
        Cow::Borrowed(ule)
    }
}

Thoughts? Needs input from:

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-data-infraComponent: provider, datagen, fallback, adaptersS-smallSize: One afternoon (small bug fix or enhancement)T-enhancementType: Nice-to-have but not requiredhelp wantedIssue needs an assignee

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions