Skip to content

Thread into_async should be generic on args #508

Closed
@cheesycod

Description

@cheesycod

Right now, Thread::into_async is not really usable because it returns a AsyncThread<impl IntoLuaMulti, R> where the impl IntoLuaMulti is the same as A:

    pub fn into_async<R>(self, args: impl IntoLuaMulti) -> AsyncThread<impl IntoLuaMulti, R>
    where
        R: FromLuaMulti,
    {
        AsyncThread {
            thread: self,
            init_args: Some(args),
            ret: PhantomData,
            recycle: false,
        }
    }

Instead, this should probably use a second type parameter of A in into_async to allow for rust to correctly infer the type using the passed value for args like so:

    pub fn into_async<A, R>(self, args: A) -> AsyncThread<A, R>
    where
        A: IntoLuaMulti
        R: FromLuaMulti,
    {
        AsyncThread {
            thread: self,
            init_args: Some(args),
            ret: PhantomData,
            recycle: false,
        }
    }

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