Skip to content

There should be an impl<T> AsMut<[T]> for Vec<T>. #28549

Closed
@dwrensha

Description

@dwrensha

In GJ I have this trait like this:

pub trait AsyncRead: 'static {
    fn try_read<T>(self, buf: T, min_bytes: usize) -> Promise<(Self, T, usize), Error<(Self, T)>> where T: DerefMut<Target=[u8]>, Self: Sized;
}

I'd like to switch the bound on T to be T: AsMut<[u8]>, but then I can no longer use a bare Vec<u8> for T, because there is currently no impl<T> AsMut<[T]> for Vec<T>.

It seems to me that such an impl ought to exist, especially because impl<T> AsRef<[T]> for Vec<T> already exists.

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