Skip to content

change core::borrow::BorrowFrom to core::borrow::Borrow  #530

Closed
@mandel59

Description

@mandel59

core::borrow::BorrowFrom is now defined as:

pub trait BorrowFrom<Sized? Owned> for Sized? {
    fn borrow_from(owned: &Owned) -> &Self;
}

The proposal core::borrow::Borrow simply swaps the type parameters Owned and Self. A: Borrow<T> means it is able to borrow a value typed as T from a value typed as A.

pub trait Borrow<Sized? T> for Sized? {
    fn borrow(&self) -> &T;
}

This changes BorrowFrom::borrow_from(&x) to x.borrow().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions